usenet-mail-0306.20.chr0n0ss at spamgourmet.com
Sat Sep 29 23:40:26 CEST 2007
Kevin Walzer wrote:
> I'm having a problem with searching a list. Here's my code:
> mylist = ['x11', 'x11-wm', 'x11-system']
> for line in mylist:
> if 'x11' in line:
> print line
> This results in the following output:
> I'm looking to return the list item that just has 'x11'.
Why do you want to have an item you already know?
If you just wanted to check *if* the string "x11" is in the list,
if "x11" in mylist:
BOFH excuse #221:
The mainframe needs to rest. It's getting old, you know.
More information about the Python-list