I would like to learn more about Python, can someone help me?
- Do a tutorial on Youtube. I like the Indently tutorials. I just like his style. I like that he starts with 1 concept at a time and only adds 1 new concept with each step. Indently search: https://www.youtube.com/results?search_query=free+python+tutorial+indently
- Longer tutorial search here on Youtube
- This is the main discussion group. The people have been really helpful to me. I just started learning Python in March 2024.
- https://pypi.org has all the documentation on the modules you need. If you install Python it also has local help files.
- Test regular expressions here: https://regex101.com/ This tool will help you learn how they work.
- Install Python locally and make a development environment for each project. THis will help you when you want to compile your program into an EXE/executable file. The environment is required. https://python.org has the files to download.
- Use the most recent version of Python as some modules have not been updated in years and will not work. Ask here to find the modules that are constantly updated and used.
- Indentation is critical in Python. Make sure when you post code here it is formatted correctly.
- Beware of using AI to solve programming problems. The code is sometimes outdated, uses outdated modules, or just doesn’t work, so I stopped using it.
- Visual Studio Code (free) is a really useful IDE to find errors in your code before you run it. Consider installing it. It also has plugins to see data in SQL, Sqlite3, JSON and other files. https://visualstudio.microsoft.com/
- You can practice Python in Google Colab if you want but I don’t know how to handle reading files. https://colab.research.google.com/
- Run Python in your browser with Pyscript. You can practice code online if you want. https://pyscript.net/
Help us help you. Read this link first and learn how to format code so we can help you better. About the Python Help category You will get more help this way.
Also be sure to include this information in every new post you make.
- Your OS name and version.
- Which Python, Colab, Jupyter, Pyscript you are using and it’s version.
- If you are using a development environment. This is normally required except perhaps while taking a Python class.
- Your IDE name and version like Pycharm or Visual Studio Code. VSC sometimes has addons that can help you.
Hi,
you can try out the book Learning Python
by Mark Luntz
. It is a very comprehensive book that covers most Python fundamentals in a very thorough manner. I would highly recommend it. Use it as your curriculum or roadmap. When you find that you need additional information on a particular subject, take an off ramp and do research online (videos / tutorials / etc). Once you feel that you have understood the current subject, go back to the book and continue following along.
Good luck!
Thank you very much, this information is really useful to me, because I’m hooked on Python, thank you very much.
How can I get that? Is it available on Amazon?
Yes it is:
Hi c-rob ;
"6. [quote=“Chuck R., post:2, topic:64507, username:c-rob”]
Install Python locally and make a development environment for each project. THis will help you when you want to compile your program into an EXE/executable file. The environment is required. https://python.org has the files to download.
[/quote]
"
I am also new to Py
Two questions-
- What do you mean by-“make a development environment for each project.”?
- “compile your program into an EXE/executable file.”-
a- Is it possible to compile a .py into an .exe ?
b- And if so , then would user not need to install .py , etc.?
c- would the .exe the run on MACOS & Linux ?
Thanks for your Help…
a “development environment” can be a virtual environment (see this, other development tools also build on this) or something similar like Conda environments. their main purpose is to faciliate seperate namespaces for package installations.
Virutal environment
Here’s a condensed version of the development environment process.
A virtual environment makes sure that if you have a 5 year old project, it’s libraries do not clash with a new project you just made. But you have more copies of the libraries on your disk, because there are copies for each project. But it makes the whole process easier if you want to compile to an EXE file
- Install Python. This includes checking your path is set up correctly to the Python EXE and it’s libraries.
- Make a project directory for all Python projects. Call it “Pyprojects”.
- Under “Pyprojects” make a new directory for one project, call it “Project1”. So you end with with directories like “Pyprojects/Project1”.
- Go to directory “Project1”.
cd project1
. - Make your environment while inside the project1 dir: There are different tools to do this. I use
virtualenv
. Type:virtualenv .venv
. - Before installing libraries, activate the environment.
.venv\scripts\activate
. Your command prompt should now be prefixed with “.venv” which is the name of the environment we made above. - Now install python libraries with pip, they will be installed under the
.venv
directory. Ex:pip install pandas
installs the pandas library which is used for reading and writing spreadsheets, CSV files, etc. You will often need another library to go with this likexlswriter
. So just ask if you get an error when you run the program.
Compile Python to EXE
Most popular packages to do this are:
- Pyinstaller. It’s for Python 3.8+ only. PyInstaller Manual — PyInstaller 6.10.0 documentation
- cs_freeze. It supports Python 3.8 to 3.12 right now. Python v3.13 is still in release candidate status but will be released in October I think. cx_Freeze 7.2.2 documentation
- Py2app. py2app - Create standalone Mac OS X applications with Python — py2app 0.28.8 documentation For Mac only.
And if so , then would user not need to install .py , etc.?
Correct they would need the EXE file only, they would not have to install Python, that’s the point of an EXE file. All libraries are in the EXE file but for Pyinstaller you need to specify an option for that. Pyinstaller, which I’ve used, does not compile in all libraries by default. I think you use the --onefile
switch.
c- would the .exe the run on MACOS & Linux ?
For windows, yes. For mac, see Py2app above. For Linux, see quote below. From the first page of Pyinstaller docs:
PyInstaller is tested against Windows, MacOS X, and Linux. However, it is not a cross-compiler; to make a Windows app you run PyInstaller on Windows, and to make a Linux app you run it on Linux, etc. x PyInstaller has been used successfully with AIX, Solaris, FreeBSD and OpenBSD but testing against them is not part of our continuous integration tests,
Tip 1: Key point: Watch out for this error:
pip install selenium
Requirement already satisfied: selenium in c:\users\MYUSER\ ...
This means the package is already installed in that environment.
Tip 2: Also the name you use for the import statement like import dotenv
does not always match the name you use to install it via pip. For this example you must use pip install python-dotenv
.
Handy links, Please write this down
- Where you get Python to install and Python docs. https://python.org
- Where you get libraries and library documentation. https://pypi.org
- Indently free Python tutorials. https://www.youtube.com/results?search_query=indently+python+tutorial
Personally I think starting out with anaconda and Spyder worked really well.
If you install anaconda, you have python, a good context manager, and a good IDE for beginners (which is Spyder).
Yes you need a context manager, but I would just usa “general purpose” environment until your forced to make a specialised one. I’ve only had to make a specialised environment twice so far. The good anaconda installation guides walk you through setting it up so that you’re always in the “general purpose” env by default.
Awesome
Done: Handy links, Please write this down
Thanks
I have written Python books for beginners that are free to read online at https://inventwithpython.com
Many people start with Automate the Boring Stuff with Python, but this blog post can tell you which book to start with based on your interests: Which Al Sweigart Python Books Should I Start Reading? - The Invent with Python Blog