Hey, thanks, this has worked out for me.
i am trying to do as much of this as possible in IDLE because
it lets me know on the fly what is messed up.
thanks for your help
shawn <><
--
http://mail.python.org/mailman/listinfo/python-list
Roy Smith wrote:
> That being said, index() isn't isn't going to work if there are duplicate
> lines in the file; it'll return the index of the first one.
It will still work, if you are willing to do a bit of work to help it:
>>> l = range(10) + [5]
>>> l
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 5]
>>>
In article <[EMAIL PROTECTED]>,
Peter Hansen <[EMAIL PROTECTED]> wrote:
> [EMAIL PROTECTED] wrote:
> > i need to be able to get the index for an item in a list.
>
> > any ideas?
>
> Fire up the interactive interpreter and learn to use it to help
> yourself. In this case, the most useful thing
In article <[EMAIL PROTECTED]>,
[EMAIL PROTECTED] wrote:
> hey there,
> i need to be able to get the index for an item in a list.
> the list is a list of lines read from a text file.
>
> like this:
>
> file = open("/home/somefile.text", "r")
> lines = file.readlines()
> file.close()
>
> now, i
[EMAIL PROTECTED] wrote:
> i need to be able to get the index for an item in a list.
> any ideas?
Fire up the interactive interpreter and learn to use it to help
yourself. In this case, the most useful thing might be to know about
the dir() builtin method, which you can use on a list like so:
hey there,
i need to be able to get the index for an item in a list.
the list is a list of lines read from a text file.
like this:
file = open("/home/somefile.text", "r")
lines = file.readlines()
file.close()
now, i want to see if a certain string is == to one of the lines
and if so, i need to k