Python3基础 str partition 以参数字符串切分字符串,只切分为三部分
- 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 hello WORLD'
In [2]: my_str
Out[2]: 'hello WORLD hello WORLD'
In [3]: my_str.partition(' ')
Out[3]: ('hello', ' ', 'WORLD hello WORLD')
In [4]: # 空格仍在新的元组里面
In [5]: 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 partition 以参数字符串切分字符串,只切分为三部分的更多相关文章
- Python3基础 str find+index 是否存在指定字符串,有则返回第一个索引值
Python : 3.7.0 OS : Ubuntu 18.04.1 LTS IDE : PyCharm 2018.2.4 Conda ...
- Python3基础 str format 位置参数与关键字参数
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基础 str while+iter+next 字符串的遍历
Python : 3.7.0 OS : Ubuntu 18.04.1 LTS IDE : PyCharm 2018.2.4 Conda ...
- Python3基础 str casefold 返回全是小写字母的新字符串
Python : 3.7.0 OS : Ubuntu 18.04.1 LTS IDE : PyCharm 2018.2.4 Conda ...
- Python3基础 str capitalize 返回新字符串,第一个字母大写
Python : 3.7.0 OS : Ubuntu 18.04.1 LTS IDE : PyCharm 2018.2.4 Conda ...
- Python3基础 str : 对字符串进行切片
Python : 3.7.3 OS : Ubuntu 18.04.2 LTS IDE : pycharm-community-2019.1.3 ...
- Python3基础 str split 用指定的字符将字符串分割
Python : 3.7.0 OS : Ubuntu 18.04.1 LTS IDE : PyCharm 2018.2.4 Conda ...
- Python3基础 str lstrip 去掉字符串左边的空格
Python : 3.7.0 OS : Ubuntu 18.04.1 LTS IDE : PyCharm 2018.2.4 Conda ...
随机推荐
- 通过PyPI镜像安装Python包
有时,我们直接用pip install package_name安装包时,下载很慢,我们可以尝试从PyPI镜像下载包. 这里是镜像列表和目前的状态: http://www.pypi-mirrors.o ...
- 【JMeter】如何优雅的写脚本
cc给发的视频链接: http://v.youku.com/v_show/id_XMzA4Mjg1ODA0MA==.html?spm=a2h3j.8428770.3416059.1 ————————— ...
- linux 安装mysql yum方式
centos 6 #二进制rpm包安装 yum -y install mysql-server mysql centos7 mariadb和mysql一样的 只是一个分支 防止 mysql 被Orac ...
- 原生的强大DOM选择器querySelector - querySelector和querySelectorAll
在传统的 JavaScript 开发中,查找 DOM 往往是开发人员遇到的第一个头疼的问题,原生的 JavaScript 所提供的 DOM 选择方法并不多,仅仅局限于通过 tag, name, id ...
- Centos7 Zabbix3.2集群安装
安装环境:服务器10.80.0.191作为zabbix-server,10.80.0.191-195作为zabbix-agent. [zabbix@miyan ~]$ cat /etc/redhat- ...
- Bus System(Flody)
http://acm.hdu.edu.cn/showproblem.php?pid=1690 坑爹的题,必须用__int64 %I64d(以前没用过) 因为这题的数据特别大,所以用-1 #includ ...
- Selenium+Java元素定位之三
首先自己先准备一个表格代码: <!DOCTYPE html> <html lang="en"> <head> <meta charset= ...
- openstack 部署笔记--neutron控制节点
控制节点 配置neutron用户及服务 $ . admin-openrc $ openstack user create --domain default --password-prompt neut ...
- Lintcode: Find Peak Element
There is an integer array which has the following features: * The numbers in adjacent positions are ...
- CXF创建webservice客户端和服务端
转 一.CXF的介绍 Apache CXF是一个开源的WebService框架,CXF大大简化了Webservice的创建,同时它继承了XFire的传统,一样可以和spring天然的进行无缝的集成.C ...