From Java to Python
Pages
Home
Showing posts with label
boolean
.
Show all posts
Showing posts with label
boolean
.
Show all posts
Thursday, May 15, 2014
python: parse boolean from string
def parse_bool(s): return s.lower() in ("yes", "true", "T", "1")
NOTE:
bool('foo') # True bool('') # False
You can not use the above function to parse boolean from string.
Older Posts
Home
Subscribe to:
Posts (Atom)