什么是字面量?
在代码中,被写下来的固定的值,就是字面量。
Python 中常见的字面量:
数字(number),整数(int),浮点数(float)。
字符串(str)
字符串是任意数量的字符组成,有中文,英文,符合,数字等。字符串要有用('' '')引号包起来。
代码:
1. 666
2. 13.14
3. ''hello''
4.
5. print(666)
6. print(13.14)
7. print (''hello'')
结果:
666
13.14
Hello