Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I don't get this....
#4
Zero, None, an empty list, dict or whatever, an empty string evaluates to False.

In [1]: bool(0)
Out[1]: False

In [2]: bool([])
Out[2]: False

In [3]: bool(None)
Out[3]: False

In [4]: bool("")
Out[4]: False
Everything else evaluates to True. For example 20.
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply


Messages In This Thread
I don't get this.... - by pancit_canton - Jan-26-2018, 12:12 PM
RE: I don't get this.... - by j.crater - Jan-26-2018, 12:20 PM
RE: I don't get this.... - by pancit_canton - Jan-26-2018, 12:57 PM
RE: I don't get this.... - by wavic - Jan-26-2018, 06:11 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020