Pythonic way to determine if one char of many in a string
Stefaan Himpe
stefaan.himpe at gmail.com
Mon Feb 16 14:44:55 EST 2009
More information about the Python-list mailing list
Mon Feb 16 14:44:55 EST 2009
- Previous message (by thread): Pythonic way to determine if one char of many in a string
- Next message (by thread): Pythonic way to determine if one char of many in a string
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
An entirely different approach would be to use a regular expression:
import re
if re.search("[abc]", "nothing expekted"):
print "a, b or c occurs in the string 'nothing expekted'"
if re.search("[abc]", "something expected"):
print "a, b or c occurs in the string 'something expected'"
Best regards,
Stefaan.
- Previous message (by thread): Pythonic way to determine if one char of many in a string
- Next message (by thread): Pythonic way to determine if one char of many in a string
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list