I need to store 'http:\/\/shop.muchticket.com\/' in a variable. And then save it in a dictionary. I have tried several different methods, but none of them seems to work, here are some examples of what I've tried:
url = 'http:\/\/shop.muchticket.com\/'
print url
>> http:\\/\\/shop.muchticket.com\\/
With raw
url = r'http:\/\/shop.muchticket.com\/'
print url
>> http:\\/\\/shop.muchticket.com\\/
With the escape character
url = 'http:\\/\\/shop.muchticket.com\\/'
print url
>> http:\\/\\/shop.muchticket.com\\/
Raw and escape character
url = r'http:\\/\\/shop.muchticket.com\\/'
print url
>> http:\\\\/\\\\/shop.muchticket.com\\\\/
Escape character and decode
url = 'http:\\/\\/shop.muchticket.com\\/'
print url.decode('string_escape')
>> http:\\/\\/shop.muchticket.com\\/
Decode only
url = 'http:\/\/shop.muchticket.com\/'
print url.decode('string_escape')
>> http:\\/\\/shop.muchticket.com\\/
Aucun commentaire:
Enregistrer un commentaire