a = 'asd'
b = 'dsa'
if a is not None and b is not None:
pass
there is any way to improve this segment of code?
Also tried:
if not (a is None, b is None):
if not (a, b is None):
Both are not working.
Use the in-built function all()
a = 'asd'
b = 'dsa'
print all([a,b])
#True
In case one or more of the variables is None It would produce False
So if you want to use this with some condition, The code would be:
a = 'asd'
b = 'dsa'
if all([a,b]):
print 'All True!!!!'
#All True!!!!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With