June 2012
Intermediate to advanced
136 pages
2h 50m
German
#Suche nach Spider-Man, Spiderman, SPIDER-MAN usw.
import re
dailybugle = 'Spider-Man Menaces City!'
pattern = r'spider[- ]?man.'
if re.match(pattern, dailybugle, re.IGNORECASE):
print dailybugle#Datumsangaben in Formaten wie MM/DD/YYYY,
# MM-DD-YY ... erkennen
import re
date = '12/30/1969'
regex = re.compile(r'^(\d\d)[-/](\d\d)[-/](\d\d(?:\d\d)?)$')
match = regex.match(date)
if match:
monat = match.group(1) #12
tag = match.group(2) #30
jahr = match.group(3) #1969#<br> XHTML-konform in <br /> umwandeln import re text = 'Hallo Welt! <br>' regex = re.compile(r'<br>', re.IGNORECASE); repl = r'<br />' result = regex.sub(repl,text)
#urlify ...
Read now
Unlock full access