Issue
For example, if passed the following:
a = []
How do I check to see if a
is empty?
Solution
if not a:
print("List is empty")
Using the implicit booleanness of the empty list
is quite Pythonic.
Answered By - Patrick
For example, if passed the following:
a = []
How do I check to see if a
is empty?
if not a:
print("List is empty")
Using the implicit booleanness of the empty list
is quite Pythonic.
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.