mirror of
https://gitlab.com/octtspacc/staticoso
synced 2025-06-05 22:09:23 +02:00
More coherent conf. flags, Updated README, minor code improv.
This commit is contained in:
@ -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)
|
||||
|
Reference in New Issue
Block a user