Re: [Tutor] trouble with re

2006-05-08 Thread Ertl, John
@python.org Subject:Re: [Tutor] trouble with re Ertl, John wrote: > I have a file with 10,000 + lines and it has a coma delimited string on each > line. > > The file should look like: > > DFRE,ship name,1234567 > FGDE,ship 2, > ,sdfsf > > The ,sdfsf line is bad

Re: [Tutor] trouble with re

2006-05-08 Thread Kent Johnson
Ertl, John wrote: > I have a file with 10,000 + lines and it has a coma delimited string on each > line. > > The file should look like: > > DFRE,ship name,1234567 > FGDE,ship 2, > ,sdfsf > > The ,sdfsf line is bad data > > p = re.compile('\d{7}$ | [,]$') # this is the line that I can not get

[Tutor] trouble with re

2006-05-08 Thread Ertl, John
I have a file with 10,000 + lines and it has a coma delimited string on each line. The file should look like: DFRE,ship name,1234567 FGDE,ship 2, ,sdfsf The ,sdfsf line is bad data Some of the lines are messed up...I want to find all lines that do not end in a comma or seven digits and do som