str1 = "selected"
isSelected = True
result = str1 * isSelected
print "-----result------", result
isSelected = False
result = str1 * isSelected #get empty string
print "-----result------", result
print "-----type(result)------", type(result)
Output
=====
-----result------ selected
-----result------
-----type(result)------type 'str'>
No comments:
Post a Comment