سؤال

I'm parsing a bunch of files for specific urls..

The subdirectory can be upper-case, lower-case or camel-case in these:

search = "http://website.com/content/" + subdirectory + "/?"
begin = contents.rfind(search)

It would be great for this to work regardless of the case of the sub-directory.

هل كانت مفيدة؟

المحلول

begin = contents.lower().rfind(search.lower())
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top