What is the regular expression to match strings (in this case, file names) that start with \'Run\' and have a filename extension of \'.py\'?
The regular expression s
For a regular expression, you would use:
re.match(r'Run.*\.py$')
A quick explanation:
However, for this task, you're probably better off using simple string methods. ie.
filename.startswith("Run") and filename.endswith(".py")
Note: if you want case insensitivity (ie. matching "run.PY" as well as "Run.py", use the re.I option to the regular expression, or convert to a specific case (eg filename.lower()) before using string methods.