How on earth do i shrink this monstrosity:
I´m using python 3
if "arME" in file or "deDE" in file or "enUS" in file or "esES" in file or "ptBR" in file or "itIT" in file:
How on earth do i shrink this monstrosity:
I´m using python 3
if "arME" in file or "deDE" in file or "enUS" in file or "esES" in file or "ptBR" in file or "itIT" in file:
Typically one would use an alternative regex:
p = re.compile('arME|deDE|enUS|esES|ptBR|itIT')
if p.search(file):
...
The A|B
in a regex means match either A
or B
, where A
and B
are arbitrary regexes. It can be extended to an arbitrary number of regexes.