靚麗時尚館

位置:首頁 > 健康生活 > 心理

python中upper函式含義

心理2.99W
python中upper函式含義

Python upper() 方法將字串中的小寫字母轉為大寫字母。

語法

upper()方法語法:

r()

引數

NA。

返回值

返回小寫字母轉為大寫字母的字串。

例項

以下例項展示了 upper()函式的使用方法:

#!/usr/bin/python

str = "this is string !!!"

print &#r() : ", r()

以上例項輸出結果如下:

r() : THIS IS STRING !!!

例項擴充套件:

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)()

print ("go B go!")

class C(A):

def go(self):

super(C, self)()

print ("go C go!")

def stop(self):

super(C, self)()

print ("stop C stop!")

class D(B,C):

def go(self):

super(D, self)()

print ("go D go!")

def stop(self):

super(D, self)()

print ("stop D stop!")

def pause(self):

print ("wait D

標籤:函式 python upper