0% found this document useful (0 votes)
11 views1 page

How to Create and Run Python Scripts

To create and run Python scripts, first make a new directory and change into it. Python files should end in .py and can be run by typing "python filename.py" or adding "#!usr/bin/env python" to the top and running "./filename.py". If permissions are incorrect, use "chmod +x filename.py" to fix.

Uploaded by

Nguyen Van Cuong
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views1 page

How to Create and Run Python Scripts

To create and run Python scripts, first make a new directory and change into it. Python files should end in .py and can be run by typing "python filename.py" or adding "#!usr/bin/env python" to the top and running "./filename.py". If permissions are incorrect, use "chmod +x filename.py" to fix.

Uploaded by

Nguyen Van Cuong
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Creating and Running Python Scripts

When starting a new project, create a directory and change into it:
mkdir directoryname
cd directoryname

Running a Python file:


- all Python files should have a .py suffix
python [Link]

Or, add to the top of each Python file:


#!usr/bin/env python

Then file can be run as:


>> ./ [Link]

If permissions are not correct:


chmod +x [Link]

You might also like