python中upper是做什么用的
Python upper()方法
Python 字符串
描述
Python upper() 方法將字符串中的小寫字母轉(zhuǎn)為大寫字母。
語法
upper()方法語法:
str.upper()
參數(shù)
NA。
返回值
返回小寫字母轉(zhuǎn)為大寫字母的字符串。
實例
以下實例展示了 upper()函數(shù)的使用方法:
#!/usr/bin/python str = "this is string example....wow!!!" print "str.upper() : ", str.upper()
以上實例輸出結(jié)果如下:
str.upper() : THIS IS STRING EXAMPLE....WOW!!!
實例擴展:
class A(): def go(self): print ("go A go!") def stop(self): print ("stop A stop!") def pause(self): raise Exception("Not Implemented") class B(A): def go(self): super(B, self).go() print ("go B go!") class C(A): def go(self): super(C, self).go() print ("go C go!") def stop(self): super(C, self).stop() print ("stop C stop!") class D(B,C): def go(self): super(D, self).go() print ("go D go!") def stop(self): super(D, self).stop() print ("stop D stop!") def pause(self): print ("wait D wait!") class E(B,C): pass a = A() b = B() c = C() d = D() e = E() # 說明下列代碼的輸出結(jié)果 a.go() print('--------') b.go() print('--------') c.go() print('--------') d.go() print('--------') e.go() print('--------') a.stop() print('--------') b.stop() print('--------') c.stop() print('--------') d.stop() print('--------') e.stop() print(D.mro()) a.pause() b.pause() c.pause() d.pause() e.pause()
到此這篇關(guān)于python中upper是做什么用的的文章就介紹到這了,更多相關(guān)python中upper的作用內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
python中的os.mkdir和os.makedirs的使用區(qū)別及如何查看某個模塊中的某些字母開頭的屬性方法
這篇文章主要介紹了python中的os.mkdir和os.makedirs的使用區(qū)別及如何查看某個模塊中的某些字母開頭的屬性方法,本文給大家介紹的非常詳細,對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友可以參考下2023-03-03Python將CSV文件轉(zhuǎn)化為HTML文件的操作方法
很多朋友問小編Python如何將CSV文件轉(zhuǎn)化為HTML文件,csv文件讀取怎么操作呢?帶著這些問題一起通過本文學(xué)習(xí)吧2021-06-06在Python中畫圖(基于Jupyter notebook的魔法函數(shù))
這篇文章主要介紹了在Python中畫圖(基于Jupyter notebook的魔法函數(shù)),文中通過示例代碼介紹的非常詳細,對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友可以參考下2019-10-10使用Python實現(xiàn)簡單的人臉識別功能(附源碼)
Python中實現(xiàn)人臉識別功能有多種方法,依賴于python膠水語言的特性,我們通過調(diào)用包可以快速準(zhǔn)確的達成這一目的,本文給大家分享使用Python實現(xiàn)簡單的人臉識別功能的操作步驟,感興趣的朋友一起看看吧2021-12-12Pandas庫之DataFrame使用的學(xué)習(xí)筆記
這篇文章主要介紹了Pandas庫之DataFrame使用的學(xué)習(xí)筆記,文中通過示例代碼介紹的非常詳細,對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2019-06-06