summaryrefslogtreecommitdiffstats
path: root/module/Utils.py
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2011-04-24 21:05:09 +0200
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2011-04-24 21:05:09 +0200
commit5d804ae1c6e6b35966f0886a4b27602f4f7e1aee (patch)
treef2cce5dd0b588a2704ab48a3751e0b59bda5f4a7 /module/Utils.py
parentparse content disposition (diff)
downloadpyload-5d804ae1c6e6b35966f0886a4b27602f4f7e1aee.tar.xz
fixes char replacement
Diffstat (limited to 'module/Utils.py')
-rw-r--r--module/Utils.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/module/Utils.py b/module/Utils.py
index 3d344a147..fee1dee0f 100644
--- a/module/Utils.py
+++ b/module/Utils.py
@@ -21,6 +21,13 @@ def decode(string):
except:
return string
+def removeChars(string, repl):
+ """ removes all chars in repl from string"""
+ if type(string) == str:
+ return string.translate(None, repl)
+ elif type(string) == unicode:
+ return string.translate(dict([(ord(s), None) for s in repl]))
+
def save_join(*args):
""" joins a path, encoding aware """
paths = []
@@ -104,3 +111,5 @@ def parseFileSize(string): #returns bytes
if __name__ == "__main__":
print freeSpace(".")
+
+ print replace("ab'cdgdsf''ds'", "'ghd")