摘要: 点击查看代码 str1 = ' hello , welcome to the world ' # 去除字符串左右两边空白 str1.strip() 'hello , welcome to the world' # 去除字符串右边空白 str1.rstrip() ' hello , welcome t 阅读全文
posted @ 2022-07-02 17:57 灵、主 阅读(7) 评论(0) 推荐(0) 编辑
摘要: partition() 根据指定的分隔符 (sep) 将字符串进行分割,从字符串左边开始索引分隔符 sep, 索引到则停止索引,返回的是一个包含三个元素的元组 (tuple),即 (head, sep, tail)。 repartiton()是从后往前开始分割 点击查看代码 s = 'hello, 阅读全文
posted @ 2022-07-02 17:50 灵、主 阅读(42) 评论(0) 推荐(0) 编辑
摘要: 字符串分割 split() rsplit() 跟split相比,它是从字符串最后面往前开始分割 splitlines() 按照 (\n, \r, \r\n 等) 分隔,分割成列表 点击查看代码 s = 'hello, welcome to the world' # 按空格分割 s.split() [ 阅读全文
posted @ 2022-07-02 17:38 灵、主 阅读(63) 评论(0) 推荐(0) 编辑
摘要: 点击查看代码 # reshape用法 # numpy.arange(n).reshape(a,b)依次生成n个自然数,并且以a行b列的数组形式显示 import numpy as np array = np.arange(16).reshape(2, 8) print(array) # output 阅读全文
posted @ 2022-04-30 15:43 灵、主 阅读(220) 评论(0) 推荐(0) 编辑
摘要: https://www.runoob.com/python/python-func-zip.html 阅读全文
posted @ 2022-04-29 10:49 灵、主 阅读(13) 评论(0) 推荐(0) 编辑
摘要: Python map() 函数 | 菜鸟教程 (runoob.com) 阅读全文
posted @ 2022-04-29 10:41 灵、主 阅读(15) 评论(0) 推荐(0) 编辑
摘要: https://www.runoob.com/python/python-func-reduce.html 阅读全文
posted @ 2022-04-29 10:39 灵、主 阅读(7) 评论(0) 推荐(0) 编辑
摘要: set集合《python中文指南》P66 阅读全文
posted @ 2022-04-22 19:48 灵、主 阅读(5) 评论(0) 推荐(0) 编辑
摘要: dict字典《python中文指南》P62 阅读全文
posted @ 2022-04-22 19:47 灵、主 阅读(6) 评论(0) 推荐(0) 编辑
摘要: tuple元组《python中文指南》P59 阅读全文
posted @ 2022-04-22 19:42 灵、主 阅读(4) 评论(0) 推荐(0) 编辑