>>> a=1
>>> type(a)? ?//type()查看变量数据类型
<class 'int'>
>>> b='1'
>>> type(b)
<class 'str'>
>>> a=True
>>> type(a)
<class 'bool'>?//对于单个字符的编码(ASCII),Python提供了
ord()
函数获取字符的整数表示,chr()
函数把编码转换为对应的字符
>>> ord('A')?
65
>>> chr(66)
'B'//? /表示转义字符
>>> print('I am 'ok'')
? File "<stdin>", line 1
? ? print('I am 'ok'')
? ? ? ? ? ^^^^^^^^^
SyntaxError: invalid syntax. Perhaps you forgot a comma?
>>> print('I am \'ok\'')
I am 'ok'
>>> print('I am \n\'ok\'')
I am
'ok'
>>> print('''a
... b
... c''')
a
b
c
>>>