Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试检测给定的单词,例如在以下文本中:
for i in range(40):
我可以轻松检测到所有标识符,但它检测for为标识符而不是“for”。我r'[for]'用作正则表达式,但它不起作用。
for
r'[for]'
我认为这取决于您使用的版本
for i in range[a, z]: and what ever yo want here