python中upper是做什么用的
Python upper()方法
Python 字符串
描述
Python upper() 方法將字符串中的小寫字母轉(zhuǎn)為大寫字母。
語法
upper()方法語法:
str.upper()
參數(shù)
NA。
返回值
返回小寫字母轉(zhuǎn)為大寫字母的字符串。
實(shí)例
以下實(shí)例展示了 upper()函數(shù)的使用方法:
#!/usr/bin/pythonstr = 'this is string example....wow!!!'print 'str.upper() : ', str.upper()
以上實(shí)例輸出結(jié)果如下:
str.upper() : THIS IS STRING EXAMPLE....WOW!!!
實(shí)例擴(kuò)展:
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): passa = 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)容請(qǐng)搜索好吧啦網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持好吧啦網(wǎng)!
相關(guān)文章:
1. python如何換行輸出2. Python使用urlretrieve實(shí)現(xiàn)直接遠(yuǎn)程下載圖片的示例代碼3. Python:UserWarning:此模式具有匹配組。要實(shí)際獲得組,請(qǐng)使用str.extract4. Android Studio中一套代碼多渠道打包的實(shí)現(xiàn)方法5. Java 接口和抽象類的區(qū)別詳解6. python如何計(jì)算圓的面積7. Java使用Tesseract-Ocr識(shí)別數(shù)字8. Android打包篇:Android Studio將代碼打包成jar包教程9. 詳解java google Thumbnails 圖片處理10. 解決Android Studio 格式化 Format代碼快捷鍵問題
