日韩无码专区无码一级三级片|91人人爱网站中日韩无码电影|厨房大战丰满熟妇|AV高清无码在线免费观看|另类AV日韩少妇熟女|中文日本大黄一级黄色片|色情在线视频免费|亚洲成人特黄a片|黄片wwwav色图欧美|欧亚乱色一区二区三区

RELATEED CONSULTING
相關咨詢
選擇下列產品馬上在線溝通
服務時間:8:30-17:00
你可能遇到了下面的問題
關閉右側工具欄

新聞中心

這里有您想知道的互聯(lián)網營銷解決方案
創(chuàng)新互聯(lián)Python教程:Pythonrstrip()

python 中的rstrip()函數(shù)根據(jù)給定的參數(shù)刪除原始字符串副本中的尾隨字符。方法將此副本作為輸出返回。

 **string.rstrip([chars])** #where chars are those to remove from right 

rstrip()參數(shù):

函數(shù)的作用是:將一組字符作為參數(shù)。如果未提供字符,則從字符串中刪除尾隨空格。

參數(shù) 描述 必需/可選
燒焦 要作為尾隨字符移除的字符 可選擇的

rstrip()返回值

返回值始終是字符串。在找到第一個匹配之前,所有字符組合都將從右側開始移除。

| 投入 | 返回值 | | 線 | 字符串的副本 |

Python 中rstrip()方法的示例

示例rstrip()在 Python 中是如何工作的?

 string1 = "     python     "

string2 = string1.rstrip()

print("of all programming languages", string2, "is my favorite") 

輸出:

 of all programming languages     python is my favorite 

示例 2:在 Python 中使用rstrip()

 # Variable declaration  
string1 = "Python and Java* "  
# Calling function  
string2 = string1.rstrip(*)  
# Displaying result  
print("Before strip: ",string1)  
print("After strip: ",string2) 

輸出:

 Before strip:  Python and Java* 
After strip:  Python and Java 

本文標題:創(chuàng)新互聯(lián)Python教程:Pythonrstrip()
標題網址:http://www.5511xx.com/article/cddhgjd.html