In my Python Program, I have lines to open an input file:
f = open('/home/han/fasta.txt',"r")
and to write an output file:
with open("output.txt", "w") as text_file:
text_file.write ("{:<16}{:<16}{:<16}{:<16}{:<16}".format('','A','C','G','T')+'\n')
However, every time I want to run the Python program in Linux Command Prompt with different, I have to change the input and output file names in codes. I would like to know how to achieve running the program at Linux command prompt exactly as below: (in which I need to enter "-i" and "-o" for input and output file names respectively)
$ python codon.py -i fasta.txt -o output.txt
I have tried for the input file name
from sys import argv
script, filename = argv
f = open(filename,"r")
but I felt it doesn't necessarily need the "-i" in command prompt.
Sorry if the question is incredibly obvious...I am new to Python
Use python standard
argparse
library....etc