feature request: string.contains('...')
__peter__ at web.de
Fri Sep 24 10:21:47 CEST 2010
Wim Feijen wrote:
> I was wondering, how to make a feature request?
You can post suggestions to improve python on the python-ideas mailing list
or make feature requests on the bugtracker at bugs.python.org
> I would really like having a string.contains('...') function which returns
> either True or False. I know I can mimick this behaviour by saying
> string.find('...') != -1 , however, I find this harder to read.
> string.contains('...') is easier to understand and more closely resembles
> natural language.
In modern python those functions provided by the string module that are also
available as methods should not be used anymore. Instead of
If you are not interested in the position of the substr use the "in"
if substr in s:
print "not found"
More information about the Python-list