语法错误:扫描字符串文字时 EOL -Python [英] SyntaxError: EOL while scanning string literal -Python

查看:87
本文介绍了语法错误:扫描字符串文字时 EOL -Python的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在这部分扫描字符串文字时收到 SyntaxError: EOL.

system.cpu.workload = LiveProcess(cmd = 'hello', executable ='hello')

感谢任何帮助.

谢谢你!

解决方案

问题是你在 hello(cmd = 'hello') 周围使用了不同类型的引号.左边一个是ASCII单引号,另一个是RIGHT SINGLE QUOTATION MARK.

<预><代码>>>>'你好'文件<ipython-input-56-3231cc2cf7bf>",第 1 行'你好'^语法错误:扫描字符串文字时 EOL>>>'你好''你好'

' 实际上是一个 unicode 字符:><预><代码>>>>"'".decode('utf-8')你'\u2019'

I am getting SyntaxError: EOL while scanning string literal in this part.

system.cpu.workload = LiveProcess(cmd = 'hello’, executable ='hello')

Any help would be apreciated.

Thank you in advantage!

解决方案

Problem is you're using different types of quotes around hello(cmd = 'hello’). One on the left is ASCII single quote and other one is RIGHT SINGLE QUOTATION MARK.

>>> 'hello’
  File "<ipython-input-56-3231cc2cf7bf>", line 1
    'hello’
            ^
SyntaxError: EOL while scanning string literal

>>> 'hello'
'hello'

is actually a unicode character:

>>> "’".decode('utf-8')
u'\u2019'

这篇关于语法错误:扫描字符串文字时 EOL -Python的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆