Hi Tutors, suppose I have four files in the current directory: 1.temp, 2.temp, 3.temp, and 4.temp. I want to use glob, or anything else, to print the contents of the files in their respective orders, where the content of 1.temp gets printed, then 2.temp, then 3.temp, then 4.temp. I write the following, but it does not get me what I want:
import glob for path in glob.iglob("*.temp"): infile = open(path) for line in infile: print line.strip() # This prints e...@emad-laptop:~/Desktop/TEMP$ python globbing.py This is four This is one This is two This is three Could somebody please tell me how to get the output in the right order? -- لا أعرف مظلوما تواطأ الناس علي هضمه ولا زهدوا في إنصافه كالحقيقة.....محمد الغزالي "No victim has ever been more repressed and alienated than the truth" Emad Soliman Nawfal Indiana University, Bloomington http://emnawfal.googlepages.com --------------------------------------------------------
_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor