Hi everybody!
Today I’m going to explain you how to create a “.py” file and run it with a OS Terminal, in this case I’m going to use Ubuntu 10.04 LTS (And Is Awesome!).
Lets go.
- Downloading Atom (If you already have it you can omit this step) Go to the page https://atom.io/ and choose the correct package for your OS(in my case y choose the “.rpm” archive), after you got the program install it.
- Once you installed Atom, run it (When I Installed, it automatically get into my dock)
- After you run it you are going to see a black page, the first you have to do in order to write python code you need to set atom in python mode.
- When you set python as your language you are ready to code, this time I will write a very simple code, only performing an arithmetic operation and then print the result #Beginning of The Code x=1+1
print(x)
#End Of The Code - After You Write Your Code it’s time to save it, never forget to put a “.py” extension after the name of your program .
- Once you saved your code and you have it located it’s time to run a terminal and check if your terminal have installed Python3, the only thing you need to do is write down on your terminal python3 and you need to get the next message.
- If you got that message you are ready to run your “.py” file, you only need to write “cd” and the name of the folder where you have your “py” file like in my case “cd Documents” respecting the capital letters and spaces.
- Then Click enter, if the command is correct the next step is call the file but before calling your file you need to specify the language of your code in this case python3 writing “python3″and then the name of your file “python3 mastery01.py” in my case.
- After that click enter and enjoy the results!
If you enjoy my post thank me, if you have any correction or question contact me and I will help you, thanks for reading.
#Mastery01 Create And Run a “.py” file in a OS (#Ubuntu)terminal and Atom. by LuisNajera is licensed under a Creative Commons Attribution 4.0 International License.