在 dos 命令行 中输入:
python3 -m timeit -s ‘text = “sample string”; char = “g”’ 'char in text’
报错:SyntaxError: EOL while scanning string literal(如下图)
这是因为 cmd语法 不能正确识别单引号 导致的
解决方法: 将单引号放在双引号里面
python -m timeit -s “text = ‘sample string’; char = ‘g’” "char in text"
注: 关于 cmd 中的单双引号 问题,详见:cmd 中的单双引号
cmd报错:SyntaxError: EOL while scanning string literal
最新推荐文章于 2024-05-29 20:12:12 发布