主页
Python
Python tokenize 模块
demo_ref_module_tokenize_basic
运行 ❯
×
更改方向
保存代码
更改主题
import tokenize import io code = 'x = 42' tokens = list(tokenize.generate_tokens(io.StringIO(code).readline)) print(f'Found {len(tokens)} tokens')
Found 5 tokens