Pages

Friday, May 9, 2014

python: conditional expression









x = true_value if condition else false_value

if isinstance(s, basestring if sys.version_info[0]<3 else str):
    print('It is a str.')

see also




No comments:

Post a Comment