#直接输入abc,和用print(’abc')的区别
print('abc')
>>>abc #直接输出结果
'abc'
>>>'abc' #输出结果和类型
#路径处理
#1.直接将路径显示出来,此时路径结果并非我们想要的
>>> path = "c:\python33\1.txt"
>>> print(path)
c:\python33.txt
>>>
#2.使用原始字符串r,在路径前面加入r即可
>>> path =r"c:\python33\1.txt"
>>> print(path)
c:\python33\1.txt
>>>
#3.使用转义符\,将路径中的\进行转义
>>> path = "c:\\python33\\1.txt"
>>> print(path)
c:\python33\1.txt
>>>
#得到变量的数据类型
>>> type(1)
<class 'int'>
>>> type('a')
<class 'str'>
>>> type(1.23)
<class 'float'>
>>>
>>> isinstance(1,int)
True
>>> isinstance(1,float)
False
>>>
00初识python3
最新推荐文章于 2022-11-06 00:31:35 发布