python大小寫(xiě)同時(shí)轉(zhuǎn)換 python里面”helloworld“大小寫(xiě)是怎么區(qū)分的?
python里面”helloworld“大小寫(xiě)是怎么區(qū)分的?如果輸出為“Hello world”,則h和W為大寫(xiě)。如果您使用程序識(shí)別大小寫(xiě),您可以取出每個(gè)字符并判斷其編碼是在41~5A還是61~7a(
python里面”helloworld“大小寫(xiě)是怎么區(qū)分的?
如果輸出為“Hello world”,則h和W為大寫(xiě)。
如果您使用程序識(shí)別大小寫(xiě),您可以取出每個(gè)字符并判斷其編碼是在41~5A還是61~7a(十六進(jìn)制數(shù))之間。例如:
對(duì)于“Hello world”中的C:
如果ord(C)>=0x41和ord(C)<=0x5a:打印“shoes”
如果ord(C)>=0x61和ord(C)<=0x7a:打印“uppercase”
否則:打印“不是字母!