|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
1. >>>X = 3
2. >>>Print(x)
3. >>>3
4. 变量名不能以数字大头:
5. >>>X = loveyou1314 是可以的
6. >>>X = 520baby 是错误的
7. python区分大小写,任何一个字母的大小不同就代表不同名字
8. Python3支持中文作为变量:
9. >>>幸运数 = 588
10. >>>print(幸运数)
11. >>>588
12. python变量是会变得,取最后一次定义的值
13. >>>name = "小甲鱼"
14. >>>name = "老乌龟"
15. >>>print(name)
16. >>>老乌龟
17. python不同变量的值还可以进行传递①
18. >>>X = 3
19. >>>Y = 5
20. >>>Y = X
21. >>>print(y)
22. >>>3
23. python不同变量的值还可以进行传递互换②
24. >>>X = 3
25. >>>Y = 5
26. >>>X, Y = Y, X
27. >>>print(X,Y)
28. >>>5,3
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.
|
|