转自Stackoverflow.备忘用. Question In Python 2 I could do the following: import numpy as np f = lambda x: x**2 seq = map(f, xrange(5)) seq = np.array(seq) print seq # prints: [ 0 1 4 9 16] In Python 3 it does not work anymore: import numpy as np f = lambd
from array import array """ 'b' signed char int 1 'B' unsigned char int 1 'u' Py_UNICODE Unicode character 2 (1) 'h' signed short int 2 'H' unsigned short int 2 'i' signed int int 2 'I' unsigned int int 2 'l' signed long int 4 'L' unsigned