a= [] for i in range(10): if i %2 == 0: a.append(i) > [ i for i in range(10) if i % 2 ==0] 所以列表推导式的要素有3个 1)for 循环 2)被添加的元素 3)条件 限制: 1) 条件:只有一个出口,没有els ...
分类:
其他好文 时间:
2020-06-05 22:50:04
阅读次数:
89
Block element Block elements, or block-level elements, have a rectangular structure. By default, these elements will span the entire width of its pare ...
分类:
Web程序 时间:
2020-06-05 21:12:41
阅读次数:
89
# for循环s_1 = "hello,python"# 循环遍历这个字符串中的每个字符for i in s_1: print(i)# 请计算出1-100之间整数和sum_01 = 0for i in range(1, 101): # sum_01 =sum_01 + i sum_01 += ipr ...
分类:
编程语言 时间:
2020-06-05 16:50:09
阅读次数:
87
1. 编码问题 (这两天unicode真是令我头大) pymysql.connect时提示“UnicodeDecodeError: 'ascii' codec can't decode byte 0xe7 in position 29: ordinal not in range(128)” 解决办法 ...
分类:
编程语言 时间:
2020-06-05 15:03:17
阅读次数:
72
所需要的技术有: 1、position(定位) 首先要了解position存在的意义: 元素可以使用的顶部,底部,左侧和右侧属性定位。 然而,这些属性无法工作,除非是先设定position属性。他们也有不同的工作方式,这取决于定位方法。 这里会用到的是absolute 定位,也就是绝对定位,这个绝对 ...
分类:
Web程序 时间:
2020-06-05 09:14:08
阅读次数:
85
package LeetCode_1365 import java.util.* /** * 1365. How Many Numbers Are Smaller Than the Current Number * https://leetcode.com/problems/how-many-num ...
分类:
其他好文 时间:
2020-06-04 19:56:56
阅读次数:
67
绘制特殊图表时,希望横轴显示自定义内容(如年份)而非坐标值 可以使用如xticks实现 import matplotlib.pyplot as plt plt.figure(tight_layout = True) x = range(10) h = [10, 3, 4, 8, 2, 6, 5, 1 ...
分类:
其他好文 时间:
2020-06-04 19:44:17
阅读次数:
66
1、输入n的值,求出n的阶乘 i=int(input("请输入数字:")) sum=1 for i in range(1,i+1): sum=sum*i print(sum) 2、求和 求s= a + aa + aaa + … + aa…a 的值(最后一个数中 a 的个数为 n ),其中 a 是一个 ...
分类:
编程语言 时间:
2020-06-04 15:33:34
阅读次数:
121
matlab中的filter函数: y = filter(b,a,x) python实现matlab中的filter函数 def filter_matlab(b,a,x): y = [] y.append(b[0] * x[0]) for i in range(1,len(x)): y.append ...
分类:
编程语言 时间:
2020-06-04 15:19:25
阅读次数:
158
信号量, 生产者消费者问题, 吸烟者问题, 读者-写者问题, 哲学家就餐问题 ...
分类:
系统相关 时间:
2020-06-03 20:47:49
阅读次数:
112