Tuesday, July 4, 2017

Create and Run Python Script in Linux Command Line

Create and Run Python Script in Linux Command Line


create python script in linux
  1.  cd scratch
  2. mkdir new_folder
  3. cd new_folder
  4. touch test.py
  5. vi test.py
  6. Press "i"  - this will open the file in edit mode
  7. Enter below lines :
    #! /usr/bin/python
    print('Hello, world!')
  8.  Press "esc"
  9. type ":wq!" without quotes
  10. chmod a+x test.py
  11. ./test.py