I'm trying to parse URLs and count the number of Backslashes. However, in Python, this sign does not parse URLs with hex values. When I use another symbol, such as a slash ('/'), the code works well even with hex numbers. Also, when I alter the hex values to a random string, the code correctly counts the Backslashes. Here's my code:
url = "https://www.example.com/na.g?taetID\x3d5358\1542099"
print(backslashes(url))
#the output>> 0
#-------
#if I change the hex values to a random string:
#url = "https://www.example.com/na.g?taetID\mnbc\zxcd"
#print(backslashes(url))>> 2
I want to count the number of Backslashes in all URLs, even those with hex values. In the URL above, there are two backslashes.