'True' and 'False' in Python: True False
I am not a really experienced programmer. I apologize in advance should my question seem ridiculous to anyone. However, I tried running this piece of code:
path = '/bla/bla/bla'
if path is True:
print "True"
else:
print "False"
andAnd it prints False. I thought Python treats anything with value as True. Can someone shine some light onWhy is this pleasehappening?
Python: True False
I am not a really experienced programmer. I apologize in advance should my question seem ridiculous to anyone. However, I tried running this piece of code:
path = '/bla/bla/bla'
if path is True:
print "True"
else:
print "False"
and it prints False. I thought Python treats anything with value as True. Can someone shine some light on this please?
'True' and 'False' in Python
I tried running this piece of code:
path = '/bla/bla/bla'
if path is True:
print "True"
else:
print "False"
And it prints False. I thought Python treats anything with value as True. Why is this happening?
- 17.1k
- 34
- 113
- 171
I am not a really experienced programmer. I apologize in advance should my question seem ridiculous to anyone. However, I tried running this piece of code:
stringpath = '/bla/bla/bla'
if path is True:
print "True"
else:
print "False"
and it prints False. I thought Python treats anything with value as True. Can someone shine some light on this please?
I am not a really experienced programmer. I apologize in advance should my question seem ridiculous to anyone. However, I tried running this piece of code:
string = '/bla/bla/bla'
if path is True:
print "True"
else:
print "False"
and it prints False. I thought Python treats anything with value as True. Can someone shine some light on this please?
I am not a really experienced programmer. I apologize in advance should my question seem ridiculous to anyone. However, I tried running this piece of code:
path = '/bla/bla/bla'
if path is True:
print "True"
else:
print "False"
and it prints False. I thought Python treats anything with value as True. Can someone shine some light on this please?
- 906
- 1
- 19
- 37
I am not a really experienced programmer. I apologize in advance should my question ridiculeseem ridiculous to anyone. However, I'veI tried running this piece of code:
string = '/bla/bla/bla'
if path is True:
print "True"
else:
print "False"
and it prints False. I though pythonthought Python treats anything with value as True.Can Can someone shine some light on it for methis please?
I am not really experienced programmer. I apologize in advance should my question ridicule anyone. However, I've tried this piece of code:
string = '/bla/bla/bla'
if path is True:
print "True"
else:
print "False"
and it prints False. I though python treats anything with value as True.Can someone shine some light on it for me?
I am not a really experienced programmer. I apologize in advance should my question seem ridiculous to anyone. However, I tried running this piece of code:
string = '/bla/bla/bla'
if path is True:
print "True"
else:
print "False"
and it prints False. I thought Python treats anything with value as True. Can someone shine some light on this please?