python中的索引和切片,字符串方法

一、字符串方法索引

say = “there are %d monkeys in the %s!”,%d表示整数,%s表示字符串字符串

say %(3,'tree')方法

print(say %(3,'tree'))字符

二、索引

hw = "hello world"

hw[0]

hw.find('world')结果为6,此时反查hw[6:]结果为world

相关文章
相关标签/搜索