用户:
盒子的box查看:0 回复:0 评论:0 创建时间:2020-01-09T17:41:24
【作品展示】

【作品介绍】
这是一款可以格式化(将%s替换成特定字符串)字符串的程序。
【作品源代码】
def zfcgsh(zfc, thz):
a = zfc.split('%s')
b = 0
for __count in range((len(a) - 1)):
a[0] = a[b].join([a[0], a[1]])
del a[1]
return a[0]
zfce = input('你要格式化哪个字符串?')
thze = input('用什么替换?')
try:
print('结果是', zfcgsh(zfce, thze))
except TypeError:
thze = [thze]
print('结果是', zfcgsh(zfce, thze))
【提示】
部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:
https://python.codemao.cn