Python3基础 str lstrip 去掉字符串左边的空格
- Python : 3.7.0
- OS : Ubuntu 18.04.1 LTS
- IDE : PyCharm 2018.2.4
- Conda : 4.5.11
- typesetting : Markdown
code
coder@Ubuntu:~$ source activate py37
(py37) coder@Ubuntu:~$ ipython
Python 3.7.0 (default, Jun 28 2018, 13:15:42)
Type 'copyright', 'credits' or 'license' for more information
IPython 6.5.0 -- An enhanced Interactive Python. Type '?' for help.
In [1]: my_str = ' hello WORLD'
In [2]: my_str
Out[2]: ' hello WORLD'
In [3]: my_str.lstrip()
Out[3]: 'hello WORLD'
In [4]: exit
(py37) coder@Ubuntu:~$ source deactivate
coder@Ubuntu:~$
resource
- [文档] docs.python.org/3
- [规范] www.python.org/dev/peps/pep-0008
- [规范] zh-google-styleguide.readthedocs.io/en/latest/google-python-styleguide/python_language_rules
- [源码] www.python.org/downloads/source
- [ PEP ] www.python.org/dev/peps
- [平台] www.cnblogs.com
- [平台] gitee.com
Python具有开源、跨平台、解释型、交互式等特性,值得学习。
Python的设计哲学:优雅,明确,简单。提倡用一种方法,最好是只有一种方法来做一件事。
代码的书写要遵守规范,这样有助于沟通和理解。
每种语言都有独特的思想,初学者需要转变思维、踏实践行、坚持积累。
Python3基础 str lstrip 去掉字符串左边的空格的更多相关文章
- SqlSever基础 ltrim函数 除去字符串左边的空格,右边的中间的不管
镇场诗:---大梦谁觉,水月中建博客.百千磨难,才知世事无常.---今持佛语,技术无量愿学.愿尽所学,铸一良心博客.------------------------------------------ ...
- Python3基础 str 通过拆分字符串与插入新的内容形成新的字符串
Python : 3.7.0 OS : Ubuntu 18.04.1 LTS IDE : PyCharm 2018.2.4 Conda ...
- Python3基础 str for 输出字符串中的每个字符
Python : 3.7.0 OS : Ubuntu 18.04.1 LTS IDE : PyCharm 2018.2.4 Conda ...
- Python3基础 str """ 多行字符串
Python : 3.7.0 OS : Ubuntu 18.04.1 LTS IDE : PyCharm 2018.2.4 Conda ...
- Python3基础之数据类型(字符串和列表)
1.Python字符串方法 1.1.如何在Python中使用字符串 a.使用单引号(') 用单引号括起来表示字符串,例如: str1="this is string"; print ...
- C++去掉字符串中首尾空格和所有空格
c++去掉首尾空格是参考一篇文章的,但是忘记文章出处了,就略过吧. 去掉首尾空格的代码如下: void trim(string &s) { if( !s.empty() ) { s.erase ...
- as3中去掉字符串两边的空格,换行符
as3 去掉字符串两边的空格,换行符,方法一 ActionScript Code 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 pub ...
- C++去掉字符串首尾的 空格 换行 回车
/* *去掉字符串首尾的 \x20 \r \n 字符 */ void TrimSpace(char* str) { ; char *end = str; char *p = str; while(*p ...
- C++ 去掉字符串的首尾空格和全部空格
#include <iostream>#include <string>using namespace std; //去掉收尾空格string& ClearHeadTa ...
随机推荐
- MongoDB的”存储过程“
使用 db.system.js.insert({_id:"aaa", value:"zzq"}); 这条命令向全局系统的js中添加了一个_id为"aa ...
- 跟我学Makefile(七)
定义模式规则 使用模式规则来定义一个隐含规则.一个模式规则就好像一个一般的规则,只是在规则中,目标的定义需要有“%”字符.“%”的意思是表示一个或多个任意字符.在依赖目标中同样可以使用“%”,只是依赖 ...
- Tomcat修改端口和编码配置
1.打开Tomcat中server.xml文件,找到原本的8080,修改成没被占用的端口: 2.在这个标签里增加 URIEncoding="utf-8",修改请求的编码.
- PAT 1034 Head of a Gang[难][dfs]
1034 Head of a Gang (30)(30 分) One way that the police finds the head of a gang is to check people's ...
- [LeetCode] 331. Verify Preorder Serialization of a Binary Tree_Medium tag: stack
One way to serialize a binary tree is to use pre-order traversal. When we encounter a non-null node, ...
- python 全局变量与局部变量
一.引用 使用到的全局变量只是作为引用,不在函数中修改它的值的话,不需要加global关键字.如: #! /usr/bin/python a = 1 b = [2, 3] def func(): if ...
- .NET RSA解密、签名、验签
using System; using System.Collections.Generic; using System.Text; using System.IO; using System.Sec ...
- Vue.Js添加自定义插件
基于上篇我们讲了 在window下搭建Vue.Js开发环境 我们可以开发自己的vue.js插件发布到npm上,供大家下载使用. 1.首先打开cmd命令窗口,进入我们的工作目录下 执行 cd E:\vu ...
- Leetcode: Pow(x, n) and Summary: 负数补码总结
Implement pow(x, n). Analysis: Time Complexity: O(LogN) Iterative code: refer to https://discuss.le ...
- #C++初学记录(贪心算法#结构体#贪心算法)
贪心算法#结构体 Problem Description "今年暑假不AC?" "是的." "那你干什么呢?" "看世界杯呀,笨蛋 ...