This script allows one to exchange two columns in a file.And it do so for all the files in a directory. The python script is : ---------------------------- #script to read and execute column exchange for all files in the directory import os listing=os.listdir(" /home/K/Documents/PY/column_exchange ") for infile in listing: print infile if infile !="column_interchange_script.py": fi=open(infile).readlines() fo=open(infile +'_output','w') space=" " for line in fi: first,second=line.split() fo.write('%s%s%s\n'%(second,space,first)) else: print "This is not interesting file" ---------------------------------------------------- Some expert might simplify it a lot more, but for new python user like me, this is a big leap. So, how does it work: Create a directory where in all the files for which column exchange need to be done are stored. Kee...
Find some interesting facts,methods, basics in Computational Chemistry