string 模块提供了一些用于处理字符串类型的函数
案例:
#!/usr/bin/evn python
#_*_ coding:utf-8 -*-
import string
text = "Monty Python's Flying Circus"
print string.upper(text)
print string.lower(text)
print string.split(text)
print string.join(string.split(text),"+")
print string.find(text,'Python')
print string.count(text,'y')
结果:
MONTY PYTHON'S FLYING CIRCUS
monty python's flying circus
['Monty', "Python's", 'Flying', 'Circus']
Monty+Python's+Flying+Circus
6
3