2 Star 1 Fork 0

Emma/pythonStudy

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
1.py 1.19 KB
一键复制 编辑 原始数据 按行查看 历史
Tom 提交于 2022-08-09 23:04 . 1
print('Hello world')
print(r'\t')
print('''line1
line2
line3''')
a=1
t_007= '002'
answer= True
print(5/2)
print(5//2)
print(5%2)
print(ord('a'))
print(chr(97))
# Python对bytes类型的数据用带b前缀的单引号或双引号表示
print('ABC'.encode('ascii'))
print('中文'.encode('utf-8'))
print(b'\xe4\xb8\xad\xff'.decode('utf-8', errors='ignore'))
print(len('123'))
len('示'.encode('utf-8'))
print('A->%s<-A' % '123')
print('{0}'.format('123'))
str = 'qwe'
print(f'{str}')
arry = ['A','B','C']
print(arry[0])
print(arry[-1])
arry.append('D')
# 要删除list末尾的元素
arry.pop()
L = ['Apple', 123, True]
s=['A',['A','B','C']]
# tuple一旦初始化就不能修改
classmates = ('Michael', 'Bob', 'Tracy')
# 数字
t=(1)
# 元组
t = (1,)
t=()
if 100>200:
print('nitianle')
print('nitianle')
elif 200>100:
print('a')
else:
print('b')
for x in arry:
print(x)
print(list(range(5)))
# dict
names={'tom':1,'emma':2,'trump':3}
print(names['tom'])
names['tom']=2
print('tom' in names)
print(names.get('t'))
print(names.get('t','NoNoNo'))
# set
s= set([1,1,1,2,3,4,5])
print(s)
s.add(10)
s.remove(1)
print(s)
s1 = set([1, 2, 3])
s2 = set([2, 3, 4])
s1 & s2
s1 | s2
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/longing/python-study.git
git@gitee.com:longing/python-study.git
longing
python-study
pythonStudy
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385