By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,594 Members | 1,452 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,594 IT Pros & Developers. It's quick & easy.

How to check whether a list have specific value exist or not?

P: n/a
Dear All
In Php we can find in_array() function
which function is mainly useful to check
whether a specific value is exist in the array
or not.

But In python In cannot find any function
like that. I want to check a list have specific
value or not. So If any one know regarding this
mail me

with regards
PRabahar
__________________________________________________ ______________________
Yahoo! India Matrimony: Find your life partner online
Go to: http://yahoo.shaadi.com/india-matrimony
Jul 18 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
praba kar wrote:
In Php we can find in_array() function
which function is mainly useful to check
whether a specific value is exist in the array
or not.

But In python In cannot find any function
like that.


If you just want a boolean result you can use x in l:
l = range(5)
l [0, 1, 2, 3, 4] 3 in l True 42 in l

False
--
Michael Hoffman
Jul 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.