Visitar URL original
3.1.2. 字符串 End of lines are automatically included in the string 里有翻译错误 · Issue #242 · python/python-docs-zh-cn · GitHub
The Wayback Machine - https://web.archive.org/web/20220321120010/https://github.com/python/python-docs-zh-cn/issues/242
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

3.1.2. 字符串 End of lines are automatically included in the string 里有翻译错误 #242

Open
Delhpi opened this issue Mar 15, 2022 · 5 comments

Comments

@Delhpi
Copy link

@Delhpi Delhpi commented Mar 15, 2022

String literals can span multiple lines. One way is using triple-quotes: """...""" or '''...'''. End of lines are automatically included in the string, but it’s possible to prevent this by adding a \ at the end of the line.
这句话的意思,默认情况下,会有1个 换行 字符包括到那个多行字符串里。但是中文文档里说 加在字符串 行尾,
https://docs.python.org/zh-cn/3.9/tutorial/introduction.html

实际是加在 字符串 开头。
测试代码:
a ="""
Usage: thingy [OPTIONS]
-h Display this usage message
-H hostname Hostname to connect to
"""
print('a变量的长度是',len(a))
print('a变量第一个字符的ASCii是',ord(a[0]))
b="""
Usage: thingy [OPTIONS]
-h Display this usage message
-H hostname Hostname to connect to
"""
print('b变量的长度是',len(b))
print('b变量第一个字符的ASCii是',ord(b[0]))

@silkriver
Copy link

@silkriver silkriver commented Mar 16, 2022

fixed

@Delhpi
Copy link
Author

@Delhpi Delhpi commented Mar 16, 2022

@silkriver
Copy link

@silkriver silkriver commented Mar 16, 2022

据说每3小时更新一次

@Delhpi
Copy link
Author

@Delhpi Delhpi commented Mar 16, 2022

据说每3小时更新一次

是美国人更新吗?好像已经过3小时了。

@zhsj
Copy link
Collaborator

@zhsj zhsj commented Mar 16, 2022

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

Successfully merging a pull request may close this issue.

None yet
3 participants