1
message1="I love you ,China!"
print(message1)
message2="wO aI ni zhong guo"
print(message2.title()) ##首字母大寫
print(message2.upper()) ##字符串全部大寫
print(message2.lower()) ##字符串全部小寫
message3=message1.title()+" "+message2.upper() ##字符串拼接
print(message3)
創(chuàng)新互聯(lián)專業(yè)成都網(wǎng)站建設(shè)、網(wǎng)站設(shè)計(jì),集網(wǎng)站策劃、網(wǎng)站設(shè)計(jì)、網(wǎng)站制作于一體,網(wǎng)站seo、網(wǎng)站優(yōu)化、網(wǎng)站營(yíng)銷、軟文發(fā)布平臺(tái)等專業(yè)人才根據(jù)搜索規(guī)律編程設(shè)計(jì),讓網(wǎng)站在運(yùn)行后,在搜索中有好的表現(xiàn),專業(yè)設(shè)計(jì)制作為您帶來效益的網(wǎng)站!讓網(wǎng)站建設(shè)為您創(chuàng)造效益。
2
print("\tleslie") ##/t制表符
print("language:\nchinese\nenglish\njanpanese") ##換行符
print("language:\n\tchinese\t\nenglish\n\tjanpanese") ##制表符和換行符混用
3
favorite_language = ' python '
favorite_language
favorite_language.rstrip() ##刪除結(jié)尾空白
favorite_language
favorite_language.lstrip() ##刪除開頭空白
favorite_language
favorite_language.strip() ##刪除字符串開頭和結(jié)尾空白
4
name1=input("name1:")
print("hello "+name1+",would you like to learn some python today?")
5
name1=input("name1:")
print(name1.lower())
print(name1.upper())
print(name1.title())
6
print('Albert Einstein once said,"A person who never made a mistake never tried anything new."')
7
famous_person = input("famous_person:") ##輸入一個(gè)變量
print(famous_person.title()+' once said,"A person who never made a mistake never tried anything new."')
8
famous_person = "\txu\nlijian\thaha\nhaha\t"
print(famous_person)
print(famous_person.lstrip()) ##刪除開頭空格
print(famous_person.rstrip()) ##刪除結(jié)尾空格
print(famous_person.strip()) ##刪除開頭和結(jié)尾空格
print(famous_person.replace('\n','').replace('\t','')) ##連續(xù)替換\n和\t為空
網(wǎng)站欄目:[python]字符串總結(jié)
標(biāo)題網(wǎng)址:http://aaarwkj.com/article0/pdhhoo.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供商城網(wǎng)站、網(wǎng)站導(dǎo)航、品牌網(wǎng)站建設(shè)、網(wǎng)站建設(shè)、動(dòng)態(tài)網(wǎng)站、小程序開發(fā)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)