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的更多相关文章

  1. Python String startswith() Method

    一,摘自官方API  https://docs.python.org/3/library/stdtypes.html#methods str.startswith(prefix[, start[, e ...

  2. python string

    string比较连接 >>> s1="python string" >>> len(s) 13 >>> s2=" p ...

  3. Python string objects implementation

    http://www.laurentluce.com/posts/python-string-objects-implementation/ Python string objects impleme ...

  4. Python中strip()、lstrip()、rstrip()用法详解

    Python中有三个去除头尾字符.空白符的函数,它们依次为: strip: 用来去除头尾字符.空白符(包括\n.\r.\t.' ',即:换行.回车.制表符.空格)lstrip:用来去除开头字符.空白符 ...

  5. python中strip()方法学习笔记

    Python strip() 方法用于移除字符串头尾指定的字符(默认为空格). 当使用strip('xxx'),只要字符串头尾有"xxx"中的一个,就会去掉,而不是符合字符串''x ...

  6. 【Python】PYTHON中STRIP()方法学习笔记

    Python strip() 方法用于移除字符串头尾指定的字符(默认为空格). 当使用strip('xxx'),只要字符串头尾有"xxx"中的一个,就会去掉,而不是符合字符串''x ...

  7. Python中strip方法的妙用

    [开胃小菜] 当提到python中strip方法,想必凡接触过python的同行都知道它主要用来切除空格.有下面两种方法来实现. 方法一:用内置函数 #<python> if __name ...

  8. python中strip,lstrip,rstrip简介

    一.起因 今天在做角色控制中,有一个地方用到rstrip,判断用户请求的url是否与数据库对应可用权限中url相符. if request.path == x.url or request.path. ...

  9. python string module

    String模块中的常量 >>> import string >>> string.digits ' >>> string.letters 'ab ...

随机推荐

  1. 最全android Demo

    1.BeautifulRefreshLayout-漂亮的美食下拉刷新 https://github.com/android-cjj/BeautifulRefreshLayout/tree/Beauti ...

  2. myeclipse出现src作为报名一部分src.com.*

    打开历史悠久的项目,所有类报错,发现src变成了报名的一部分. 右击src->Build Path->Use as Source Folder即可. WebRoot中同理.

  3. Tornado源码分析 --- Etag实现

    Etag(URL的Entity Tag): 对于具体Etag是什么,请求流程,实现原理,这里不进行介绍,可以参考下面链接: http://www.oschina.net/question/234345 ...

  4. ASP.NET ValidationSummary 控件

    ASP.NET ValidationSummary 控件 Validation 服务器控件 定义和用法 ValidationSummary 控件用于在网页.消息框或在这两者中内联显示所有验证错误的摘要 ...

  5. Mybatis整合Spring -- typeAliasesPackage

    Mybatis整合Spring 根据官方的说法,在ibatis3,也就是Mybatis3问世之前,Spring3的开发工作就已经完成了,所以Spring3中还是没有对Mybatis3的支持. 因此由M ...

  6. 增加 修改oracle约束条件

    ALTER TABLE    TB_ZJGL_DWSB_GRMX ADD CONSTRAINT SFZH_UNIQUE UNIQUE(SFZH);    ALTER TABLE TB_ZJGL_DWS ...

  7. PHP:第五章——字符串的统计及查找

    <?php header("Content-Type:text/html;charset=utf-8"); /*字符串的统计与查找*/ //1.获取字符串的长度 //1)st ...

  8. c/c++指针常见错误

    一 #include <bits/stdc++.h> using namespace std; void f(char *str) { char *s = str; str[] = ' / ...

  9. LINUX中的RCU机制的分析

    RCU机制是Linux2.6之后提供的一种数据一致性访问的机制,从RCU(read-copy-update)的名称上看,我们就能对他的实现机制有一个大概的了解,在修改数据的时候,首先需要读取数据,然后 ...

  10. iOS面试准备之思维导图(转)

    以思维导图的方式对iOS常见的面试题知识点进行梳理复习. 目录 1.UI视图相关面试问题 2.Runtime相关面试问题 3.内存管理相关面试问题 4.Block相关面试问题 5.多线程相关面试问题 ...