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
Robert Kern wrote:
> line == 'x11'
>
D'oh! That was simple, wasn't it? *smacks head*
That did the trick. Thanks!
--
Kevin Walzer
Code by Kevin
http://www.codebykevin.com
--
http://mail.python.org/mailman/listinfo/python-list
On 28/09/2007, Kevin Walzer <[EMAIL PROTECTED]> 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
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
On Fri, 28 Sep, 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
Just compare for equality:
if line == 'x11':
or
print "\n".join(x
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'. Ho