fork download
  1. import re
  2. filepath = '/tmp/folder/file'
  3. regex = r"^([a-zA-Z]:)\\(?:.*\\)?(\d{2}-\d{2}-\d{4}[a-zA-Z]?)"
  4. with open(filepath, 'r') as f:
  5. text = f.read()
  6. match = re.search(regex, text)
  7. if match:
  8. print(f"{match.group(1)} {match.group(2)}")
Runtime error #stdin #stdout #stderr 0.17s 23344KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Traceback (most recent call last):
  File "./prog.py", line 4, in <module>
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/folder/file'