URL_Symbolic_Replace

 from urllib.parse import unquote

class UrlReplace:

    def __init__(self):

        UrlText = "https://docs.google.com/viewer?url=https%3A%2F%2Fwww.jinhong.org%2Fmoodle%2Fpluginfile.php%2Fgradebook.xlsx"

        CleanUrlText = str(unquote(unquote(UrlText)))

        print(CleanUrlText.replace("https://docs.google.com/viewer?url=",""))


        '''

        print("\n")


        bibTextPath = "bibTextToReplace" ## put the bibtext at this file under the same path

        f = open(bibTextPath, "r", encoding="ISO-8859-1")

        finalText = ""

        for line in f:

            if '={' in line:

                line = line.replace("={", "=\"")

            if "}," in line:

                line = line.replace("},", "\",")

            finalText = finalText+line


        print(finalText.replace("}\n}", "\"\n}"))

        f.close()

        '''

obj = UrlReplace()

Comments

Popular posts from this blog

attach file gives false disk address path as 'C:/fakepath/filename'

How to fix World-writable config file /etc/my.cnf is ignored?

Ajmer tour on 18th June '11