On 22/03/19 21:45, Matthew Herzog wrote:
I need to tell my script to ignore any filename that does not conform to
the standard eight leading numerical characters, example: 20180922 or
erased_20171207_1oIkZf.so.
Normally we try to dissuade people from using regex when string methods
will do but in this case a regex sounds like it might be the best option.
A single if statement should suffice
if re.match("[0-9]{8}|erased_",fname):
Your code here
There are other ways to write the regex but the above should
be clear...
HTH,
Alan G.
_______________________________________________
Tutor maillist - [email protected]
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor