- 论坛徽章:
- 0
|
原帖由 xiaoyu9805119 于 2009-2-27 10:28 发表 ![]()
>>> print re.sub("(.*) (.*)", r"\2 \1", "hello smallfish"
smallfish hello
调换匹配的
>>> print re.sub("(.*) (.*)", r"hi \2", "hello smallfish"
hi smallfish
直接修改的
看到了把,是不是 ...
<book id="1" fullname="/home/napleon/AF_yyy.so" name="yyy"></book>
>>> print re.sub("(.*)(.*)",r"\2\1","hello smallfish"
hello smallfish
>>> print re.sub("(.*)(.*)",r"hi\1","hello smallfish"
hihello smallfish
>>> print re.sub("(.*)(.*)",r"\1\2","hello smallfish"
hello smallfish
>>> print re.sub("(.*)(.*)",r"\2\1","hello smallfish"
hello smallfish
为什么我的换不了? |
|