Skip to main content
Stack Overflow
  1. About
  2. For Teams

Return to Question

Post Timeline

Post Closed as "Duplicate" by Karl Knechtel python Users with the python badge or a synonym can single-handedly close questions as duplicates and reopen them as needed.
Question Protected by Community Bot
Copy edited. Removed meta information.
Source Link
Peter Mortensen
  • 31.3k
  • 22
  • 110
  • 134

'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?

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?

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?

retagging
Link
Wooble
  • 90.6k
  • 12
  • 111
  • 132
Loading
Source Link
PSS
  • 6.2k
  • 6
  • 31
  • 32
Loading
lang-py

AltStyle によって変換されたページ (->オリジナル) /