|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
1. 字符串的分类 Single quotes Double quotes Triple quoted
2. 单引号和双引号一定要确保语句中是成双成对的
3. >>>print('let's go!') 错误写法 'let'当成变量了
4. >>>print("let's go!") 正确写法
5. 引用名句的写法"人生苦短,我用Python"
6. >>>print('"Life is short,you need Python"')
7. >>>"Life is short,you need Python"
8. 转义字符\
9. >>>print('"Life is short,let's learn Python"')
>>>SyntaxError: unterminated string literal (detected at line 1)
>>>print('\"Life is short,let\'s learn Python"\')
>>>SyntaxError: unterminated string literal (detected at line 1)
>>>print('\"Life is short,let\'s learn Python\"')
>>>"Life is short,let's learn Python"
>>>print("\"Life is short,let\'s learn Python\"")
>>>"Life is short,let's learn Python"
10. 换行符\n
print("I love Python,\nI love Python.")
I love Python,
I love Python.
|
|