- #!/usr/bin/python
- # -*- coding: UTF-8 -*-
-
- import re
- str = '''TITLE "Leslie Cheung 张国荣 LPCD45"
- PERFORMER "张国荣"
- REM DATE "2008"
- REM DISCID E3103E10
- FILE "Leslie Cheung 张国荣 LPCD45.flac" WAVE
- TRACK 01 AUDIO
- TITLE "奔向未来日子"
- PERFORMER "张都荣"
- REM COMMENT
- INDEX 01 00:00:00'''
- print re.sub('张*荣','图片',str)
复制代码 我想把张国荣,张都荣替换成图片,可是运行
后并没有被替换掉。 |