码迷,mamicode.com
首页 > 编程语言 > 详细

[Python] String strip() Method

时间:2017-03-23 21:33:32      阅读:194      评论:0      收藏:0      [点我收藏+]

标签:default   strip   turn   des   move   beginning   list   val   pac   

Description

The method strip() returns a copy of the string in which all chars have been stripped from the beginning and the end of the string (default whitespace characters).

在string中删掉strip(char)的所有char字符。

 

Syntax

str.strip([chars])

  

Parameters

  • chars -- The characters to be removed from beginning or end of the string.

 

Return Value

This method returns a copy of the string in which all chars have been stripped from the beginning and the end of the string.

 

Example

str = ‘1111234    adad‘;
print str.strip(‘1‘);

  

Result: 234    adad

  

[Python] String strip() Method

标签:default   strip   turn   des   move   beginning   list   val   pac   

原文地址:http://www.cnblogs.com/KennyRom/p/6607216.html

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