首頁>Club>
4
回覆列表
  • 1 # 使用者1708050581434

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

    語法

    upper()方法語法:

    str.upper()

    引數

    NA。

    返回值

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

    例項

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

    #!/usr/bin/python

    str = "this is string example....wow!!!"

    print "str.upper() : ", str.upper()

    以上例項輸出結果如下:

    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

  • 中秋節和大豐收的關聯?
  • 為什麼經典遺傳學只有三大定律?