Python30Days
苏雨流丰
这个作者很懒,什么都没留下…
展开
-
Python之Numpy的random模块
import numpy as np(0, 1)间的随机数(组)print(np.random.random()) # 0.9712291171155641print(np.random.random(3)) # [0.54426685 0.10859501 0.66425772]随机选择choiceprint(np.random.choice([2, 3, 5, 7], 5)) # [7 7 3 5 3]指定范围的随机整数(组\矩阵)print(np.rando原创 2022-01-22 09:35:34 · 965 阅读 · 0 评论 -
Python的Numpy数组np.array()基本用法详解(二)
本节主要讲授array获取元素、转置、重塑等方法"""@Date: 2022-01-21@Author: 苏雨流丰@lang: Python@summary: 访问、获取np.array的元素"""导入numpy包import numpy as np初始化工作np_34_list = [[1, 3, 5, 7], [2, 4, 6, 8], [1, 2, 5, 6]]np_44_list = [[1, 3, 5, 7]原创 2022-01-21 18:56:16 · 4362 阅读 · 0 评论 -
Python的Numpy数组np.array()基本用法详解(一)
Numpy的array类详解原创 2022-01-21 18:14:00 · 4248 阅读 · 0 评论 -
Python异常处理Try except else finally
try: some codeexcept XXXError: some codeexcept YYYError: some codeexcept ZZZError: some code…else: some code(if no exception happen then execute)finally: some code(always execute)while True: try: name = input('Enter your name:') yea原创 2022-01-21 12:22:42 · 282 阅读 · 0 评论 -
Python将一个函数应用到列表的每一个元素
Python的map()filter()函数——构建简单高效的代码原创 2022-01-21 11:13:08 · 1713 阅读 · 0 评论 -
python decorator函数装饰器:从函数到函数的映射
python装饰器原创 2022-01-21 10:37:02 · 252 阅读 · 0 评论 -
python字符串查找子串与各种断言函数
python字符串子串查找、是否为数字、是否为纯字母原创 2022-01-20 22:03:19 · 297 阅读 · 0 评论 -
Python(Index and slice)字符串切片常见操作
python字符串切片、反转原创 2022-01-20 17:36:33 · 344 阅读 · 0 评论 -
Python String Formating(Python字符串格式化输出)
python有三种方式格式化字符串,依次递进,话不多说,上代码:"""@Date: 2022-01-20@Learn: string formatting@Author: 苏雨流丰"""# 需要特别注意的是 string format 也即字符串格式化str01 = "Today I play with %s and get $%d in %.2f seconds" % ("Agenda", 54, 3.1415)print(str01)# 一种较好的方式是使用format, use原创 2022-01-20 17:28:04 · 322 阅读 · 0 评论