数组简单操作

mac2022-06-30  107

a = [3,4] a = a+[5,6] # [3, 4, 5, 6] a = [3,4] a.extend([5,6]) # [3, 4, 5, 6] a = [3,4] a.append(5) a.append(6) # [3, 4, 5, 6]

list()

import itertools as it it.chain(*[[34],[56]]) # out: <itertools.chain at 0x22d920442e8> import numpy as np np.concatenate(([3,4],[5,6])) # out: array([3, 4, 5, 6]) import numpy as np np.hstack(([3,4],[5,6])) # out: array([3, 4, 5, 6])
最新回复(0)