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:
> 
> x11
> x11-wm
> x11-system
> 
> 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,
you'd use

if "x11" in mylist:

Regards,


Björn

-- 
BOFH excuse #221:

The mainframe needs to rest.  It's getting old, you know.

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to