import re re_test = re.compile(r"^(?P\d{4}) (?P\d) \w\s{,3}$") # ^ @string.regexp re_test = re.compile( # comment # ^ @comment r"^(?P\d{4}){1}" # ^ @string.regexp # comment # ^ @comment r"(?P\d) \w\s{,3}" # ^ @string.regexp # comment # ^ @comment ) # interpolation print("foo %s bar %d" % ("arg1", 2)) # ^ @character