2009/7/18 <amr...@iisermohali.ac.in>: > Thankyou sir it is working.....but one more thing i want to ask that if my > file will have entries like:--- > > fileA and fileB > 12 10 > 13 12 > 14 > 15 > > means if their no. of entries will not match then how to combine them(both > input files have more than one column). > > Thanks, > Amrita > > > > Amrita Kumari > Research Fellow > IISER Mohali > Chandigarh > INDIA > > _______________________________________________ > Tutor maillist - tu...@python.org > http://mail.python.org/mailman/listinfo/tutor >
That depends entirely on what you want to happen when you encounter a row that doesn't have an entry in one of the files. The previous code, using izip(), will stop at the end of the shortest file. If you want to pad the short file, (i.e. add values to make it the same length as the longer file) you can use itertools.izip_longest(). Look it up in the docs for usage. -- Rich "Roadie Rich" Lovely There are 10 types of people in the world: those who know binary, those who do not, and those who are off by one. _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor