On Mar 31, 6:47 pm, Rhodri James rho...@wildebst.demon.co.uk
wrote:
What you're doing (pace error checking) seems fine for the data
structures that you're using. I'm not entirely clear what your usage
pattern for dip and dir is once you've got them, so I can't say
whether there's a more
Maybe you can try a regex, something like
--
import re
pattern = re.compile('^(\d+)/(\d+).*')
def read_data(filename):
fh = open(filename, r, encoding=ascii)
for line in fh:
if pattern.match(line):
dip_,dir_ = pattern.match(line).groups()
On Apr 1, 2:35 am, daku9...@gmail.com wrote:
On Mar 31, 6:47 pm, Rhodri James rho...@wildebst.demon.co.uk
wrote:
What you're doing (pace error checking) seems fine for the data
structures that you're using. I'm not entirely clear what your usage
pattern for dip and dir is once you've got
On Apr 1, 11:05 am, jay logan dear.jay.lo...@gmail.com wrote:
On Apr 1, 2:35 am, daku9...@gmail.com wrote:
On Mar 31, 6:47 pm, Rhodri James rho...@wildebst.demon.co.uk
wrote:
What you're doing (pace error checking) seems fine for the data
structures that you're using. I'm not
On Apr 1, 8:10 am, jay logan dear.jay.lo...@gmail.com wrote:
On Apr 1, 11:05 am, jay logan dear.jay.lo...@gmail.com wrote:
On Apr 1, 2:35 am, daku9...@gmail.com wrote:
On Mar 31, 6:47 pm, Rhodri James rho...@wildebst.demon.co.uk
wrote:
What you're doing (pace error checking)
Rhodri James wrote:
On Tue, 31 Mar 2009 06:51:33 +0100, daku9...@gmail.com wrote:
There has got to be a better way of doing this:
I'm reading in a file that has a lot of garbage, but eventually has
something that looks similar to:
(some lines of garbage)
dip/dir.
(some more lines of
On Tue, 31 Mar 2009 06:51:33 +0100, daku9...@gmail.com wrote:
There has got to be a better way of doing this:
I'm reading in a file that has a lot of garbage, but eventually has
something that looks similar to:
(some lines of garbage)
dip/dir.
(some more lines of garbage)
55/158
(some more
There has got to be a better way of doing this:
I'm reading in a file that has a lot of garbage, but eventually has
something that looks similar to:
(some lines of garbage)
dip/dir.
(some more lines of garbage)
55/158
(some more lines of garbage)
33/156
etc.
and I'm stripping out the 55/158