码迷,mamicode.com
首页 > 其他好文 > 详细

修改字符串大小写

时间:2018-12-15 12:03:46      阅读:126      评论:0      收藏:0      [点我收藏+]

标签:大小   rip   sage   fir   ges   字符   ace   asc   col   

name = "ada lovelace"
print(name.title())
Ada Lovelace
name2 = "Ada Lovelace"
print(name2.upper())
ADA LOVELACE
print(name2.lower())
ada lovelace
firstname = "ada"
lastname = "lovelace"
fullname = firstname+" "+lastname
print(fullname)
ada lovelace
print(fullname.title())
Ada Lovelace
print("Hello,"+fullname.title()+"!")
Hello,Ada Lovelace!
print("\tpython")
    python

 


>>> message="langueages:\nPython\nC\nJavaScript"
>>> print(message)
langueages:
Python
C
JavaScript
>>> message="python "
>>> message
python 
>>> message.rstrip()
python
>>> message
python 
>>> hehe = " python "
>>> hehe
 python 
>>> hehe.rstrip()
 python
>>> hehe.lstrip()
python 
>>> hehe.strip()
python
>>> hehe.rstrip()
 python

 


 

 

 

修改字符串大小写

标签:大小   rip   sage   fir   ges   字符   ace   asc   col   

原文地址:https://www.cnblogs.com/puyitian/p/10122646.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!