python1day

name=“add.cate”
print(name.title())#首字母大写
print(name.lower())#字母小写
print(name.upper())#字母大写
first_name=“yang”
last_name=“guang peng”
full_name=first_name+" “+last_name#+连接
print(full_name)
print(”\tpython:\n\tlanguage")#\t制表符,添加空白,\n换行符
favorite_language=" python "
favorite_language
favorite_language.rstrip()#rstrip删除右侧空格,lstrip,删除左侧空格
print(favorite_language)
ad=0.1+0.1
print(ad)
age=23
happy=“nice” +" " +str(age) +" “+ “you”#str将非字符串变为字符串
print(happy)
print(type(age))#显示类型
#列表学习
byicle=[“like”,“hate”]
print(byicle)
print(byicle[0])
print(byicle[0].title())
messeage=“my favorte”+” “+byicle[0].title()+”."
print(messeage)
test=“hello word”
print(test)
print(len(str(test)))
bycles=[12,22,36,55,89]
print(bycles[1])
bycles[0]=‘like’#改变元素
print(bycles)
bycles.append(“love”)#添加元素
print(bycles)
bycles.insert(1,‘999’)#插入元素
del bycles[0]#删除元素
bycles.pop(0)#删除任意元素
print(bycles)
bycles.remove(55)#删除任意值
print(bycles)
bycles.append(“pyhton”)
print(bycles)
cars=[‘bmw’,‘audi’,‘toyota’,‘subaru’]
cars.sort(reverse=True)#反序排列
print(cars)
cars.sort()#顺序排列
print(cars)
cars.reverse()#倒着打印
print(cars)
print(len(cars))
px=“I love hadoop python mysql”
xp=px.split(’ ')
print(len(xp))
for car in cars:#编历列表
print(car)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值