如何在 python 脚本中将 python continue 关键字用作字符串文字?
How do I use the python continue keyword as a string literal in a python script?
我正在编写 python 脚本,其中我需要使用 continue 字词。
我知道这是一个 python 关键字。
那么我应该如何编写我的脚本才能使 python 不会抱怨我将关键字用作字符串文字。
提前感谢您的宝贵时间。
通常的做法是使用尾部下划线来使用语言已经使用的关键字,例如 continue_
或 input_
。
我认为没有人会认为只覆盖关键字是个好主意。
你应该使用类似这样的东西:
_continue
但为什么不使用更具描述性和更长的变量名呢?!像:
continue_whatever
或 go_on
...
我正在编写 python 脚本,其中我需要使用 continue 字词。
我知道这是一个 python 关键字。
那么我应该如何编写我的脚本才能使 python 不会抱怨我将关键字用作字符串文字。
提前感谢您的宝贵时间。
通常的做法是使用尾部下划线来使用语言已经使用的关键字,例如 continue_
或 input_
。
我认为没有人会认为只覆盖关键字是个好主意。
你应该使用类似这样的东西:
_continue
但为什么不使用更具描述性和更长的变量名呢?!像:
continue_whatever
或 go_on
...