python中upper是做什么⽤的Python upper()⽅法
Python 字符串
描述
Python upper() ⽅法将字符串中的⼩写字母转为⼤写字母。
语法
upper()⽅法语法:
str.upper()
参数
NA。
返回值
返回⼩写字母转为⼤写字母的字符串。
实例
以下实例展⽰了 upper()函数的使⽤⽅法:
#!/usr/bin/python
str = "this is wow"
print "str.upper() : ", str.upper()
以上实例输出结果如下:
str.upper() : THIS IS 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()
python是做什么的通俗易懂的# 说明下列代码的输出结果
<()
print('--------')
<()
print('--------')
<()
print('--------')
<()
print('--------')
<()
print('--------')
a.stop()
print('--------')
b.stop()
print('--------')
c.stop()
print('--------')
d.stop()
print('--------')
e.stop()
())
a.pause()
b.pause()
c.pause()
d.pause()
e.pause()
到此这篇关于python中upper是做什么⽤的的⽂章就介绍到这了,更多相关python中upper的作⽤内容请搜索以前的⽂章或继续浏览下⾯的相关⽂章希望⼤家以后多多⽀持!

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。