2 basic methods to run Python code - QLGQ/learning-python GitHub Wiki

method 1:

qiang@qiang:/$ cd

qiang@qiang:~$ python

Python 2.7.6 (default, Jun 22 2015, 17:58:13)

[GCC 4.8.2] on linux2

Type "help", "copyright", "credits" or "license" for more information.

print('Hello world!')

Hello world!

exit()

method 2:

qiang@qiang:~$ vi hello.py

print("hello world") #vi

qiang@qiang:~$ python hello.py

hello world