摘要:
关于array: Python 本身没有数组这个说法, 有的就是list和tuple, list就具有其他语言中的数组特性. 至于list和tuple的区别,在于list可以在运行时修改内容和大小,tuple在首次创建和赋值后, 不可以再次修改内部的内容 不过python 有提供一个array模块, 阅读全文
posted @ 2018-07-29 12:21
孙龙-程序员
阅读(11680)
评论(0)
推荐(0)
摘要:
import bisect L = [1,3,3,5,7,9] x = 30 ##在L中查找x,x存在时返回x左侧的位置 x不存在返回应该插入的位置 x_insert_point = bisect.bisect_left(L,x) print(x_insert_point) #在L中查找x,x存在时返回x右侧的位置,x不存在返回应该插入的位置 x_insert_point = bisect... 阅读全文
posted @ 2018-07-29 12:15
孙龙-程序员
阅读(244)
评论(0)
推荐(0)
摘要:
1 import numbers 2 from collections import abc 3 class Group: 4 #支持切片操作 5 def __init__(self, group_name, company_name, staffs): 6 self.group_name = group_name 7 self.co... 阅读全文
posted @ 2018-07-29 12:08
孙龙-程序员
阅读(636)
评论(0)
推荐(0)