基础篇7-基本数据类型1.3

2017-01-16  本文已影响0人  梦归游子意
#a没有变
a = 'this is a dog'
b = a.replace('this', 'that')
x = a.find('dog')#x = 10
y = a.find('asfdf')#y = -1
'this is {1} {0}'.format('world', 'my')
'this is {whose} {fruit}'.format(fruit = 'apple', whose = 'my')
a = 'this is %(whose)s %(fruit)s' % {'fruit':'apple', 'whose':'my'}
上一篇下一篇

猜你喜欢

热点阅读