Sunday, January 29, 2017

How to run a code in terminal

Save the python code and name it in some folder on your desktop.
Go to terminal, go to shell in the toolbar and then click on import
Import the code you want to run
To import code:
cd location of file (i.e. desktop, documents, photos)
cd the name of the folder your file is in
 
python file.py

Then run that code in terminal (you can run some codes directly from IDLE however it's easiest to just run from terminal)
Save that code in terminal into the same folder you saved the python code in
Open the folder, double click on the code from terminal
It should open up in a tab on safari or google chrome whichever is in your settings

https://en.wikibooks.org/wiki/Python_Programming/Creating_Python_Programs

Issues:
I keep getting up to the point where I import the direct file, however for some reason it keeps saying invalid syntax. I do not know why this keeps happening.

No comments:

Post a Comment