要在 Python 中判断字符串是否为空,可以使用 if not string:。 例如: string = '' if not string: print('The string is empty')