python中upper是做什么用的
Python upper()方法
Python 字符串
描述
Python upper() 方法将字符串中的小写字母转为大写字母。
语法
upper()方法语法:
str.upper()
参数
NA。
返回值
返回小写字母转为大写字母的字符串。
实例
以下实例展示了 upper()函数的使用方法:
#!/usr/bin/pythonstr = '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 wait!')class E(B,C): passa = A()b = B()c = C()d = D()e = E()# 说明下列代码的输出结果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()
到此这篇关于python中upper是做什么用的的文章就介绍到这了,更多相关python中upper的作用内容请搜索好吧啦网以前的文章或继续浏览下面的相关文章希望大家以后多多支持好吧啦网!
相关文章:
1. python 服务器运行代码报错ModuleNotFoundError的解决办法2. python爬取抖音视频的实例分析3. python 解决pycharm运行py文件只有unittest选项的问题4. 解决python pandas读取excel中多个不同sheet表格存在的问题5. 解决python打开https出现certificate verify failed的问题6. python smtplib发送多个email联系人的实现7. ASP.NET Core 7 Razor Pages项目发布到IIS的详细过程8. 浅谈Python 钉钉报警必备知识系统讲解9. Python爬虫获取豆瓣电影并写入excel10. Python文件夹批处理操作代码实例

网公网安备