![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Python基础语法
周小敬
程序员哦
展开
-
解决python安装第三方库速度慢的方法
原文链接原创 2020-01-29 23:24:37 · 2270 阅读 · 0 评论 -
列表与集合
dict1 = {1, 2, 3, 5, 5, 0}print(dict1) #输出结果为 {1, 2, 3, 5} 集合中元素唯一#print(dict1[3]) #集合不支持根据下标读取 故该语法错误list1 = [1, 2, 3, 5, 5]print("list1=",list1)dict1 = set(list1) #...原创 2019-08-28 22:47:42 · 375 阅读 · 0 评论 -
高阶函数
#高阶函数: 可以接收函数做参数的函数def add(x, y, f): return f(x)+f(y)print("高阶函数求两整数的绝对值之和",add(4, -5, abs))#高阶函数:map()函数#map(f,list) 接收一个f函数和一个列表做参数#并将参数依次作用于列表中的元素def f(x): return x*xprint(list(m...原创 2019-09-06 16:15:07 · 151 阅读 · 0 评论 -
返回函数
def f(): print("call f()...") def g(): print("call g()...") return gx = f()x()def Get_abs(x): return abs(x) #返回值print(Get_abs(-5))def fun_abs(): return ab...原创 2019-09-09 11:56:44 · 186 阅读 · 0 评论