Python: encode special charecter
Question: I'm trying to encode a string containing '-' (minus) symbol to iso8859-15, it
will return the string as it is. for eg:

    
    
    str="abc-def"
    

Expected output is

    
    
    abc%2Ddef
    

Is there any way to do this? sorry me if my question is wrong.


Answer: ya.

    
    
    from urllib.parse import quote
    st = "abc-def"
    encoded = quote(st)
    

