mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-04-13 15:57:14 +03:00
Tidied regexp
Python regexps should always be held in r'' or raw strings, ensuring that python doesn't try to expand the regexp escapes. I also removed the escaped -, as they're only special characters in character groups
This commit is contained in:
parent
be9ac29a5b
commit
a6e6b6353d
@ -200,7 +200,7 @@ def export(data, filename=None):
|
||||
|
||||
# Look for last ship of this type
|
||||
ship = companion.ship_file_name(data['ship'].get('shipName'), data['ship']['name'])
|
||||
regexp = re.compile(re.escape(ship) + '\.\d\d\d\d\-\d\d\-\d\dT\d\d\.\d\d\.\d\d\.txt')
|
||||
regexp = re.compile(re.escape(ship) + r'\.\d{4}-\d\d-\d\dT\d\d\.\d\d\.\d\d\.txt')
|
||||
oldfiles = sorted([x for x in os.listdir(config.get('outdir')) if regexp.match(x)])
|
||||
if oldfiles:
|
||||
with open(join(config.get('outdir'), oldfiles[-1]), 'rU') as h:
|
||||
|
Loading…
x
Reference in New Issue
Block a user