More coherent conf. flags, Updated README, minor code improv.

This commit is contained in:
2022-08-29 17:50:14 +02:00
parent c546458073
commit a1e77b8f91
6 changed files with 90 additions and 59 deletions

View File

@ -84,6 +84,7 @@ def FindAllIndex(Str, Sub):
yield i
i = Str.find(Sub, i+1)
# Replace substrings in a string, except when an escape char is prepended
def ReplWithEsc(Str, Find, Repl, Esc='\\'):
New = ''
Sects = Str.split(Find)
@ -101,6 +102,11 @@ def ReplWithEsc(Str, Find, Repl, Esc='\\'):
New += Repl + e
return New
def DictReplWithEsc(Str, Dict, Esc='\\'):
for Item in Dict:
Str = ReplWithEsc(Str, Item, Dict[Item], Esc='\\')
return Str
def NumsFromFileName(Path):
Name = Path.split('/')[-1]
Split = len(Name)