How to check if the string is empty?

后端 未结 25 1844
佛祖请我去吃肉
佛祖请我去吃肉 2020-11-22 14:47

Does Python have something like an empty string variable where you can do:

if myString == string.empty:

Regardless, what\'s the most elegan

25条回答
  •  刺人心
    刺人心 (楼主)
    2020-11-22 15:18

    You may have a look at this Assigning empty value or string in Python

    This is about comparing strings that are empty. So instead of testing for emptiness with not, you may test is your string is equal to empty string with "" the empty string...

提交回复
热议问题