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 ...
随机推荐
- JS 防止表单重复提交的方法
第一种:用flag标识,下面的代码设置checkSubmitFlg标志: <script language="”JavaScript”"> var checkSubmi ...
- Pots--poj(bfs,输出路径)
http://poj.org/problem?id=3414 题意: 给你两个容量为a,b的杯子:有3个操作: 1:FILL(i):把第i个杯子从水库中装满: 2:DROP(i):把第i个杯子清空: ...
- 洛谷P2602 数字计数 [ZJOI2010] 数位dp
正解:数位dp 解题报告: 传送门! 打算在寒假把学长发过题解的题目都做辣然后把不会的知识点都落实辣! ⁄(⁄ ⁄•⁄ω⁄•⁄ ⁄)⁄ 然后这道题,开始想到的时候其实想到的是大模拟,就有点像之前考试贪 ...
- java获取系统当前服务器IP地址
public String getServiceIp(){ InetAddress address; String myIp; try { address = InetAddress.getLocal ...
- Redis 启动警告错误解决
启动错误 1.WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. T ...
- 第五课 JAVA反射获取对象属性和方法(通过配置文件)
Service1.java package reflection; public class Service1 { public void doService1(){ System.out.print ...
- 将你的wordpress博客添加到百度个性首页
当你登陆百度账号后,进入百度首页会显示新的个性首页,不仅仅有搜索框,下面还有一个小型导航,放着你经常去的网站. 百度提供了一键添加到百度首页的按钮代码. 首先,先打开分享到百度新首页代码申请页面:ht ...
- java获取屏幕密度
方法1: float xdpi = getResources().getDisplayMetrics().widthPixels;float ydpi = getResources().getDisp ...
- 深入理解python之一——python3对象的一些特性
文章使用markdown写的,编辑的时候行间距还可以,显示的时候行间距好小,我也没办法. 首先,需要明白的是python是一种解释性语言标准,他可以由c.java或者其他语言来实现.在python的标 ...
- [LeetCode] 203. Remove Linked List Elements_Easy tag: Linked LIst
Remove all elements from a linked list of integers that have value val. Example: Input: 1->2-> ...