diff --git a/func/io.py b/func/io.py index 6aca7c4..c39d53a 100644 --- a/func/io.py +++ b/func/io.py @@ -23,6 +23,12 @@ def urlExists(url): return False + +def escapeWinPath(path): + for c in ["\/", "\\", ":", "*", "?", '"', "<", ">", "|"]: + path = path.replace(c, "_") + return path + def downloadFile(url, path): opener = build_opener() @@ -35,7 +41,7 @@ def downloadFile(url, path): f.close() -def readUrl(url): +def readUrl(url: str) -> str: opener = build_opener() opener.addheaders = [('User-agent', 'Mozilla/5.0')] f = opener.open(url)