My python code is called within a bash script, and also the python script requires an input argument from bash loop. But I wasn't sure the best way to do this. Here's my attempt:
bash code:
cat filelList.txt | while read i;#file1List.txt stores file names
do
python script.py $i > $i.txt
done
python bit that i'm not sure of:
file = sys.argv[0] # not sure about this
in = open(file)
for line in iter(in): # not sure about this
do something.......
Does anyone know the best way to write these 3 python lines? Thank you
inis a reserved word, you can't use it in a variable name.sys.argv[1]is the name of the file, not 0.