# Regex pattern
filePattern = re.compile(r'''
(#LPy3THW_Ex)
(\d){1,3}
(_macOS|_Windows)?
(\.mp4)
''', re.VERBOSE)
Я пишу программу, которая должна упростить "LPy3THW_Ex6.mp4" до "ex6.mp4". Когда я запускаю его, ниже сообщение об ошибке. Я не уверен, в чем проблема и как ее исправить.
Traceback (most recent call last):
File "file_rename.py", line 13, in <module>
''', re.VERBOSE)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/re.py", line 233, in compile
return _compile(pattern, flags)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/re.py", line 301, in _compile
p = sre_compile.compile(pattern, flags)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/sre_compile.py", line 562, in compile
p = sre_parse.parse(p, flags)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/sre_parse.py", line 855, in parse
p = _parse_sub(source, pattern, flags & SRE_FLAG_VERBOSE, 0)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/sre_parse.py", line 416, in _parse_sub
not nested and not items))
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/sre_parse.py", line 768, in _parse
source.tell() - start)
sre_constants.error: missing ), unterminated subpattern at position 2 (line 2, column 2)