简体   繁体   中英

Forcing urlparse.urlsplit to preserve str case

Is there any way to force urlparse's urlsplit function to preserve the case of the str passed in? It preserves the case of the path in the returned tuple, but not of the netloc, and this is important to me. (I know domain names are case-insensitive, but, we're doing some A/B testing with different capitalizations of the name, and need to preserve case.)

Thanks.

There's no way to force urlsplit to do that.

You can, however, wrap it and then do some dirty work to restore case, or copy the source code and do the modification yourself. Or write the function from scratch, of course.

I'd go for the second option.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM