Created
December 5, 2012 15:57
-
-
Save psicobyte/4216846 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# -*-coding: utf-8 -*- | |
import re | |
string = "aaaeijfdfsafdo" | |
Resultado= re.sub("^aa.+o$", "u", string) | |
print Resultado |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
¿Qué pasa si la cadena incluye uno o más "\n"? Lo pruebo, y no se efectúa ningún reemplazo. He probado en añadir re.DOTALL como cuarto parámetro de la función re.sub, pero tampoco hace nada.