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:1…
         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:1…
// 用指定字符或字符串分割输入字符串,返回包含分割结果的数组 // @function [parent=#string] split // @param string input 输入字符串 // @param string delimiter 分割标记字符或字符串 // @return array#array 包含分割结果的数组 /* 用指定字符或字符串分割输入字符串,返回包含分割结果的数组 local input = "Hello,World" local res = strin…
string = 'This +is -a /string' process = string.split('-') process1 = string.split('-')[-1]#-1和-2可能存在某种特殊意义,小于-2或者大于1就超出list大小来 process2 = string.split('-')[0] process3 = string.split('-')[1] process4 = string.split('-')[-2]# print(process) print(pro…
Python的str类有split方法,但是这个split方法只能根据指定的某个字符分隔字符串,如果要同时指定多个字符来分隔字符串,该怎么办呢? 幸运的是python的re模块中提供的split方法可以用来做这件事情,如下代码示例: import re re.split('; |, ',str) 例如: >>> a='Beautiful, is; better*than\nugly'>>>import re >>> re.split('; |, |\*…
镇场诗: 诚听如来语,顿舍世间名与利.愿做地藏徒,广演是经阎浮提. 愿尽吾所学,成就一良心博客.愿诸后来人,重现智慧清净体.------------------------------------------code: dict1={'子':'鼠','丑':'牛','寅':'虎','卯':'兔','辰':'龙','巳':'蛇','午':'马','未':'羊','申':'猴','酉':'鸡','戌':'狗','亥':'猪'} print('子' in dict1.keys()) print('鼠'…
         Python : 3.7.0          OS : Ubuntu 18.04.1 LTS         IDE : PyCharm 2018.2.4       Conda : 4.5.11    typesetting : Markdown   code """ @Author : 行初心 @Date : 18-9-23 @Blog : www.cnblogs.com/xingchuxin @Gitee : gitee.com/zhichengji…
         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:1…
         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:1…
问题:“猿类”们都知道,编程中都会涉及到日期.时间类型与字符串类型的转换.不同场景,需要将字符串格式转换为日期类型:也需要将日期类型转换为字符串格式. 目标: 学习和积累python中time和datetime 相关知识: 一.time  引用包time import time 1.获取CTS格式: 星期 月 日 时分秒 年 time.ctime()    结果:Wed May 16 15:12:57 2018 2.字符转换为tuple(time obj) date_string = "2016…