Re: [Tutor] how to join two different files

2009-07-30 Thread wesley chun
>> Maybe you could break that up a bit? This is the tutor list, not a >> one-liner competition! > > rather than one-liners, we can try to create the most "Pythonic" solution. > below's my entry. :-) > > myMac$ cat parafiles.py > #!/usr/bin/env python > > from itertools import izip > from os.path i

Re: [Tutor] how to join two different files

2009-07-18 Thread wesley chun
on a related note, there is a module called fileinput that doesn't do what you (the OP) need for this particular problem, but it is one to keep in mind for the future as there may be a situation for which it is the right tool. it doesn't get a lot of buzz but can come in handy -- for me, it was in

Re: [Tutor] how to join two different files

2009-07-18 Thread wesley chun
>> 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 col

Re: [Tutor] how to join two different files

2009-07-18 Thread Rich Lovely
2009/7/18 : > 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 c

Re: [Tutor] how to join two different files

2009-07-17 Thread amrita
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 >> Maybe

Re: [Tutor] how to join two different files

2009-07-17 Thread wesley chun
> Maybe you could break that up a bit? This is the tutor list, not a > one-liner competition! rather than one-liners, we can try to create the most "Pythonic" solution. below's my entry. :-) cheers, -wesley myMac$ cat parafiles.py #!/usr/bin/env python from itertools import izip from os.path im

Re: [Tutor] how to join two different files

2009-07-17 Thread Emile van Sebille
On 7/17/2009 1:27 PM Kent Johnson said... On Fri, Jul 17, 2009 at 3:14 PM, Emile van Sebille wrote: delim= '\t' file('ala', 'w').writelines( [ delim.join([ii,jj] for ii,jj in zip( [xx.strip() for xx in file('/home/amrita/alachems/chem2.txt','r').readlines() ], file(

Re: [Tutor] how to join two different files

2009-07-17 Thread Kent Johnson
On Fri, Jul 17, 2009 at 3:14 PM, Emile van Sebille wrote: > delim= '\t' > > file('ala', 'w').writelines( >  [ delim.join([ii,jj] for ii,jj in >    zip( >      [xx.strip() for xx in >        file('/home/amrita/alachems/chem2.txt','r').readlines() >        ], >      file('/home/amrita/pdbfile/pdb2.t

Re: [Tutor] how to join two different files

2009-07-17 Thread Emile van Sebille
On 7/17/2009 11:37 AM amr...@iisermohali.ac.in said... Hi, I have two large different column datafiles now i want to join them as single multi-column datafile:-- I tried the command:-- file('ala', 'w').write(file('/home/amrita/alachems/chem2.txt', 'r').read()+file('/home/amrita/pdbfile/p

Re: [Tutor] how to join two different files

2009-07-17 Thread Alan Gauld
wrote but it is priniting second file after first, whereas i want to join them columwise like:--- FileA FileB FileC 12 14 12 14 15 + 16 = 15 16 18 17 18 17 20 19 20 19 I'm not sure what the plus sign in the second line signifies but otherwise it look

[Tutor] how to join two different files

2009-07-17 Thread amrita
Hi, I have two large different column datafiles now i want to join them as single multi-column datafile:-- I tried the command:-- >>> file('ala', 'w').write(file('/home/amrita/alachems/chem2.txt', 'r').read()+file('/home/amrita/pdbfile/pdb2.txt', 'r').read()) but it is priniting second file