OK, am not sure why, but
fList=file('somefile').read()
if fList.find('string') != -1:
print 'FOUND'
works much much faster.
it is strange since i thought 'for line in file('somefile')' is
optemized and read pages to the memory,
i guess not..
inary search algorithm for text files out there or do i
need to write one?
Steve Holden wrote:
> noro wrote:
> > Bill Scherer wrote:
> >
> >>noro wrote:
> >>
> >>
> >>>Is there a more efficient method to find a string in a text file then:
> >
can you add some more info, or point me to a link, i havn't found
anything about binary search in mmap() in python documents.
the files are very big...
thanks
amit
Bill Scherer wrote:
> noro wrote:
>
> >Is there a more efficient method to find a string in a text file th
:)
via python...
Luuk wrote:
> "noro" <[EMAIL PROTECTED]> schreef in bericht
> news:[EMAIL PROTECTED]
> > Is there a more efficient method to find a string in a text file then:
> >
> > f=file('somefile')
> > for line in f:
> >if &
Is there a more efficient method to find a string in a text file then:
f=file('somefile')
for line in f:
if 'string' in line:
print 'FOUND'
?
BTW:
does "for line in f: " read a block of line to te memory or is it
simply calls f.readline() many times?
thanks
amit
--
http://mail.py
Hello again.
I have a task i need to do and i can't seem to find an elegent
solution.
i need to make a tree like data structure (not necessry a binary tree).
i would like each node to access his sons in a dicionary kind of why,
for example: if ROOT node has the name 'A' and 'AA', 'AB' are his
s
is code style? it is not very OOP, but i
cant see how one can do it other wise, and be able to control the
function printed out with something as easy as dictionary..
Georg Brandl wrote:
> noro wrote:
> > Is it possible to do the following:
> >
> > for a certain class:
> >
Is it possible to do the following:
for a certain class:
class C:
def func1(self):
pass
def func2(self):
pass
def func4(self):
pass
obj=C()
by some way create a dictionary that look somthing like t
Fredrik Lundh wrote:
> Scott David Daniels wrote:
>
> > For silly module myprog.py:
> > def A(s):
> > print '---'+s+'---'
> > in test_myprog.py:
> > import unittest
> > from cStringIO import StringIO # or from StringIO ...
>
> why are you trying to reinvent doctest ?
>
>
What is the proper way to test (using unit test) a method that print
information?
for example:
def A(s):
print '---'+s+'---'
and i want to check that A("bla") really print out "---bla---"
thanks
amit
--
http://mail.python.org/mailman/listinfo/python-list
John Roth wrote:
> noro wrote:
> > Hi all,
> >
> > I use a method that accept multiply arguments ("plot(*args)").
> > so plot([1,2,3,4]) is accepted and plot([1,2,3,4],[5,6,7,8]) is also
> > accepted.
> >
> > the problem is that i know th
Hi all,
I use a method that accept multiply arguments ("plot(*args)").
so plot([1,2,3,4]) is accepted and plot([1,2,3,4],[5,6,7,8]) is also
accepted.
the problem is that i know the number of arguments only at runtime.
Let say that during runtime i need to pass 4 arguments, each is a list,
creatin
thanks bruno
Bruno Desthuilliers wrote:
> noro wrote:
> > hello all.
> >
> > I do some coding in python but this is my first attampt to write
> > somthing for hte web.
> >
> > I need to write a cgi-bin script for a web-server, and i've got the
> &g
hello all.
I do some coding in python but this is my first attampt to write
somthing for hte web.
I need to write a cgi-bin script for a web-server, and i've got the
access for it from our "SYSTEM". the problem is that this script uses
some modules (pg, pyLab) that i've installed localy in my hom
14 matches
Mail list logo