Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

转义字符语法错误 EOL while scanning string literal #54

Open
yfu6 opened this issue Mar 18, 2020 · 1 comment
Open

转义字符语法错误 EOL while scanning string literal #54

yfu6 opened this issue Mar 18, 2020 · 1 comment

Comments

@yfu6
Copy link

yfu6 commented Mar 18, 2020

**Is your feature request related to a problem? Please describe.
数据类型教程中的转义字符代码部分,打出
I'm a GIAer.
I'm learning machine learning by 'python'.这两句话时,显示语法错误
File "", line 1
print('I'm a GIAer.\nI'm learning machine learning by'Python'')
^
SyntaxError: EOL while scanning string litera

Describe the solution you'd like 说出你的解决建议
把开头结尾的‘改成双引号之后问题解决,可以正常输出
print("I'm a GIAer.\nI'm learning machine learning by'Python'")

@Gakiii
Copy link

Gakiii commented Mar 12, 2021

print('I'm a GIAer.\nI'm learning machine learning by'Python'')

在单引号前面加反斜杠也可以 , 因为你用‘ 作为字符串包含的话,前面的一个’ 就会被当作字符串结束符号 所以I‘m的'也要转义一下

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants