Re: [Tutor] Spaces and tabs messing up code

2008-01-08 Thread Robert Hicks
[EMAIL PROTECTED] wrote: > my friend uses vim > and i use xemacs > so our shared python code is a mix of tabs and spaces and it is hard for > him to edit it in vim > > any idea on how to make it clean > convert it all to 4 spaces? > > Thanks > :set ts=4 :retab! :h retab ___

Re: [Tutor] Fastest way to iterate through a file

2007-07-01 Thread Robert Hicks
Alan Gauld wrote: > "Robert Hicks" <[EMAIL PROTECTED]> wrote >> This is the loop code: >> >> for line in f2: >> for id in idList: >> if id in line: >> print "%s: %s" % (id, f2.next()) >>

Re: [Tutor] Fastest way to iterate through a file

2007-06-26 Thread Robert Hicks
Kent Johnson wrote: > Robert Hicks wrote: >> Kent Johnson wrote: >>> Robert Hicks wrote: >>>> idList only has about 129 id numbers in it. >>> That is quite a few times to be searching each line of the file. Try >>> using a regular expression search

Re: [Tutor] Fastest way to iterate through a file

2007-06-26 Thread Robert Hicks
Kent Johnson wrote: > Robert Hicks wrote: >> idList only has about 129 id numbers in it. > > That is quite a few times to be searching each line of the file. Try > using a regular expression search instead, like this: > > import re > regex = re.compile('|

Re: [Tutor] Fastest way to iterate through a file

2007-06-26 Thread Robert Hicks
Kent Johnson wrote: > Robert Hicks wrote: >> This is the loop code: >> >> for line in f2: >> for id in idList: >> if id in line: >> print "%s: %s" % (id, f2.next()) >> found = "%s: %s" % (id, f

Re: [Tutor] Fastest way to iterate through a file

2007-06-26 Thread Robert Hicks
Kent Johnson wrote: > Robert Hicks wrote: >> I have a script at work where I have a list of id numbers and I am doing a: >> >> for line in ehFile: > > That is fine > >> for id in line: > > I don't know what this is for - line is a string, i

[Tutor] Fastest way to iterate through a file

2007-06-25 Thread Robert Hicks
I have a script at work where I have a list of id numbers and I am doing a: for line in ehFile: for id in line: I am then going through that file and finding the line the id is on and printing the next line out. It takes a few seconds to see the output to the screen (the Perl versi

Re: [Tutor] Needed Python 2.5 quick reference.

2007-01-27 Thread Robert Hicks
Vikram Shenoy wrote: > Hi All, > > The link for the python 2.5 quick reference > (http://rgruet.free.fr/PQR25/PQR2.5.html) doesn't seem to be working. > Can anybody point me to any mirror link or share the document if you > have downloaded it already ? A4 PDF version will be great. > > Regards