您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

Python数据结构之Array用法实例

2024/3/15 15:06:14发布22次查看
本文实例讲述了python数据结构之array用法,分享给大家供大家参考。具体方法如下:
import ctypes class array: def __init__(self, size): assert size > 0, array size must be > 0 self._size = size pyarraytype = ctypes.py_object * size self._elements = pyarraytype() self.clear(none) def clear(self, value): for index in range(len(self)): self._elements[index] = value def __len__(self): return self._size def __getitem__(self, index): assert index >= 0 and index =0 and = 0 and index =0 and <= size self._elements[index] = value def __iter__(self): return _arrayiterator(self._elements) class _arrayiterator: def __init__(self, thearray): self._arrayref = thearray self._curndr = 0 def __next__(self): if self._curndr =0 and row =0 and col= 0 and row = 0 and col < len(self.numcols), \ row and col is invalidate thearray = self._therows[row]; thearray[col] = value
希望本文所述对大家的python程序设计有所帮助。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product