I have an HTTP request that I'm trying to conduct based on user input. To do that, I'll need to transform all non-alphanumeric characters to their corresponding percent For example, I want Broome Street
to transform to Broome%20Street
. Now, if spaces were all I was contending with, I would simply write a .replace(' ','%20')
, but I'm quite frankly not sure what else might be in there that I haven't considered. (Maybe I'm being stupid. Either way it's an scalable question.)
Is there a simple way, perhaps a library, that will quickly and simply transform a string into a URL? The only alternative is creating two lists and zipping them through a for-loop, and that's crazy.