Re: file reading by record separator (not line by line)
- From: Tijs <tijs_news@xxxxxxxxxxxxxxx>
- Date: Thu, 31 May 2007 15:15:02 +0200
aspineux wrote:
something like
name=None
lines=[]
for line in open('yourfilename.txt'):
if line.startwith('>'):
if name!=None:
print 'Here is the record', name
print lines
name=line.stripr('\r')
lines=[]
else:
lines.append(line.stripr('\n'))
That would miss the last chunk.
--
Regards,
Tijs
.
- References:
- file reading by record separator (not line by line)
- From: Lee Sander
- Re: file reading by record separator (not line by line)
- From: Lee Sander
- Re: file reading by record separator (not line by line)
- From: aspineux
- file reading by record separator (not line by line)
- Prev by Date: Re: file reading by record separator (not line by line)
- Next by Date: Re: Python memory handling
- Previous by thread: Re: file reading by record separator (not line by line)
- Next by thread: Re: file reading by record separator (not line by line)
- Index(es):