I'm going crazy as I learn python.
Here is a code fragment:
import re
class Spam:
def egg(self, pat):
print pat
attribute_pattern = r'(\s[a-z\-]+=".*?")*'
ok_uber_string = '<(us-patent-grant)' r'(\s[a-z\-]+=".*?")*' '>(.*?)(</\1>)'
bad_uber_string = '<(us-patent-grant)' attribute_pattern '>(.*?)(</\1>)'
pat = re.compile(bad_uber_string)
the line with bad_uber_string will not compile, get a SyntaxError: invalid syntax
This has to be a user error, what am I doing wrong?
Thanks Pat