av激情亚洲男人的天堂国语,日韩欧美精品一中文字幕,无码av一区二区三区无码,国产又色又爽又刺激的a片,国产又色又爽又刺激的a片

創(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()返回值

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

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

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://uogjgqi.cn/article/cddhgjd.html
掃二維碼與項(xiàng)目經(jīng)理溝通

我們在微信上24小時(shí)期待你的聲音

解答本文疑問/技術(shù)咨詢/運(yùn)營咨詢/技術(shù)建議/互聯(lián)網(wǎng)交流