What does """ do?
Automate the Boring Stuff has a program that changes American dates to European dates. The first part of the code goes:
datePattern = re.compile(r"""\^(.\*?)
#one or two digits for the month
((0|1)?\\d)\-
#one or two dgits for the day
((0|1|2|3)?\\d)\-
#four digits for the year
((19|20)\\d\\d)
#all text after the date
(.\*?)$
""", re.VERBOSE)
I have a pretty vague idea of what everything does except for the r"""\^ part on the first line. what does """ do?
/r/Python
https://redd.it/8pghas
Automate the Boring Stuff has a program that changes American dates to European dates. The first part of the code goes:
datePattern = re.compile(r"""\^(.\*?)
#one or two digits for the month
((0|1)?\\d)\-
#one or two dgits for the day
((0|1|2|3)?\\d)\-
#four digits for the year
((19|20)\\d\\d)
#all text after the date
(.\*?)$
""", re.VERBOSE)
I have a pretty vague idea of what everything does except for the r"""\^ part on the first line. what does """ do?
/r/Python
https://redd.it/8pghas
reddit
r/Python - What does """ do?
3 votes and 1 so far on reddit