在 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
猜你喜欢
转载自blog.csdn.net/ljr_123/article/details/104868074
今日推荐
周排行