用法:
Packer.pack_list(list, pack_item)
包裝
list
的同類物品。此方法對於大小不確定的列表很有用;即在整個列表走完之前,大小不可用。對於列表中的每一項,首先打包一個無符號整數1
,然後是列表中的數據值。pack_item
是調用以打包單個項目的函數。在列表的末尾,一個無符號整數0
被打包。例如,要打包一個整數列表,代碼可能如下所示:
import xdrlib p = xdrlib.Packer() p.pack_list([1, 2, 3], p.pack_int)
相關用法
- Python xml.etree.ElementTree.XMLParser用法及代碼示例
- Python xml.etree.ElementTree.Element用法及代碼示例
- Python xml.parsers.expat.ExpatError.code用法及代碼示例
- Python xml.parsers.expat.ParserCreate用法及代碼示例
- Python xml.dom.pulldom.DOMEventStream.expandNode用法及代碼示例
- Python xml.etree.ElementTree.canonicalize用法及代碼示例
- Python torch.distributed.rpc.rpc_async用法及代碼示例
- Python torch.nn.InstanceNorm3d用法及代碼示例
- Python sklearn.cluster.MiniBatchKMeans用法及代碼示例
- Python pandas.arrays.IntervalArray.is_empty用法及代碼示例
- Python tf.compat.v1.distributions.Multinomial.stddev用法及代碼示例
- Python numpy.less()用法及代碼示例
- Python tf.compat.v1.distribute.MirroredStrategy.experimental_distribute_dataset用法及代碼示例
- Python Sympy Permutation.list()用法及代碼示例
- Python dask.dataframe.Series.apply用法及代碼示例
- Python scipy.ndimage.binary_opening用法及代碼示例
- Python pyspark.pandas.Series.dropna用法及代碼示例
- Python torchaudio.transforms.Fade用法及代碼示例
- Python dask.dataframe.to_records用法及代碼示例
- Python pyspark.pandas.groupby.SeriesGroupBy.unique用法及代碼示例
注:本文由純淨天空篩選整理自python.org大神的英文原創作品 xdrlib.Packer.pack_list。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。