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 ...
随机推荐
- OKEX API
本文介绍OKEX API Rest 开始使用 REST,即Representational State Transfer的缩写,是目前最流行的一种互联网软件架构.它结构清晰.符合标准.易于理解.扩展方 ...
- java web启动后执行初始化任务
写一个类继承ApplicationListener,可以直接引用下述代码,然后调用相应的方法. package com.linewell.system; import com.linewell.cac ...
- Spark-Cache与Checkpoint
一.Cache缓存操作 scala> val rdd1 = sc.textFile("hdfs://192.168.146.111:9000/logs") rdd1: org ...
- kubernetes网络原理
1.1. 基础原则 每个Pod都拥有一个独立的IP地址,而且假定所有Pod都在一个可以直接连通的.扁平的网络空间中,不管是否运行在同一Node上都可以通过Pod的IP来访问. k8s中Pod的IP是最 ...
- easyui DataGrid表体单元格跨列rowspan
最近做项目用到了jquery easyui,其中一组DataGrid做的报表是给客户大领导看的,客户要求报表样式跟他们原有系统的一模一样(如下图1). DataGrid样式好调,只是城市名称单元格跨行 ...
- mac 10.12显示隐藏文件
macOS Sierra 10.12版本 显示隐藏文件 1.显示隐藏文件 打开Terminal 输入:defaults write com.apple.finder AppleShowAllFil ...
- dedecms调用副栏目文章怎么操作
最近ytkah的网站进行改版,添加了一些新栏目,做更精准的着陆页,有些文章比较简短并且很早以前就发布过了,如果再添加这样的文档就有点重复了,于是就想着用文章副栏目的属性,可却调不出来,怎么办?查找官方 ...
- end=‘’
print('----------------') a = ['aa','bb','cc','dd','ee'] for i in range(len(a)): print(i,a[i])#默认换行 ...
- java中Integer 和String 之间的转换
java中Integer 和String 之间的转换 将数组转换成字符串:char[] array = {'a','b','c','d','e'};String str = new String(ar ...
- 在Java中使用Sqlite数据库
一.安装 下载最新的 Sqlite Jdbc 驱动程序jar文件,并添加到Java工程的class路径下: 二.使用 以 sqlite Jdbc 驱动版本为 sqlitejdbc-v56.jar 为例 ...