Check whether the string is empty or not in Python

We can use boolean logic to check whether the string is empty or not.

if not string:
        print "string empty"
else:
        print string

That's all......

 

Leave a Reply

Your email address will not be published. Required fields are marked *