python布尔类型和复数,转义字符
2019-01-23 11:01 janease 阅读(24) 评论(0) 收藏 举报>>> type(True)
<class 'bool'>
>>> type(False)
<class 'bool'>
>>>
>>> int(True)
1
>>> int(False)
0
>>> print("hello \n word")
hello
word
>>> print("hello \\n word")
hello \n word
>>>
当一个字符串前面加了一个r之后,这个字符串就不是普通字符串,而是一个原始字符串(字符串就不会按照转义字符处理)
>>> print("c:\\noth:8808\\norht")
c:\noth:8808\norht
>>> print(r"c:\noth:8808\norht")
c:\noth:8808\norht
>>>
浙公网安备 33010602011771号