python字符串处理训练课题报告_python作业--字符串操作练习

实例:输出12个星座符号,以反斜线分隔。

实例:恺撒密码的编码

输入姓名,格式输出:占4位、居中、不足4字的以空格填充。

格式化输出:中华人民共和国国内生产总值(GDP)689,136.89亿元(2015年)(千分位、2位小数,浮点数)

实例:打出99乘法表

实例: 下载一首英文的歌词或文章,统计单词出现的次数,将所有,.?!替换为空格,将所有大写转换为小写。

用webbrowser,uweb.open_new_tab('url')打开校园新闻列表

for i in range(12):print(chr(9800+i),end="\\")

key=int(input("输入密钥:"))

s=input("input:")for i ins:if 97 <= ord(i) <= 122:print(chr(97+ (ord(i) - 97)+ 3) % 26))else:print(chr(ord(i)+key))

name=input(":")print("{0: ^4}".format(name))

s=float(input("money:"))print("中华人民共和国国内生产总值(GDP)为:{0:,.2f}亿元(2015)".format(s))

for i in range(1,10):for j in range(1,i+1):print("{}*{}={}".format(i,j,i*j),end="\t")print(end="\n")

song='''"spend all your time waiting for that second chance

for the break that will make it ok

there's always some reason to feel not good enough

and it's hard at the end of the day

i need some distraction or a beautiful release

memories seep from my veins

let me be empty or weightless and maybe

l'll find some peace tonight

in the arms of the angel far away from here

from this dark cold hotel room and the endlessness that you feel

you are pulled from the wreckage of your silent reverie

you are in the arms of the angel, may you find some comfort here

so tired of the straight line and everywhere you turn

there's vultures and thieves at your back

the storm keeps on twisting, you keep on building the lies

that make up for all that you lack

it don't make no difference, escape one last time

it's easier to believe

in this sweet madness oh this glorious sadness

that brings me to my knees

in the arms of the angel far away from here

from this dark, cold hotel room and the endlessness that you feel

you are pulled from the wreckage of your silent reverie

in the arms of the angel ,may you find some comfort here

in the arms of the angel, may you find some comfort here"'''

print(song.lower())for i in range(0,26):print("{0}:{1}".format(chr(97+i),song.count(chr(97+i))))

s=input("输入单词")print(song.count(s))

importwebbrowser

webbrowser.open_new_tab('www.baidu.com')

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值