# when you want to read the file from terminal in python use import sys f = open(sys.argv[1]) line=f.readline()