Python Cookbook学习记录 ch1_17_2013/10/25
摘要:
1.16替换字符串中的字串给定一个字符串,通过查询一个替换字典,将字典中被标记的子字符串替换掉>>> new_style = string.Template('this is $fst and this is $snd')>>> print new_style.substitute(fst=5,snd=10)this is 5 and this is 10>>> print new_style.substitute({'fst':5,'snd':10})this is 5 and this i 阅读全文
posted @ 2013-10-25 21:34 七海之风 阅读(170) 评论(0) 推荐(0)
浙公网安备 33010602011771号