+ 1
Does array.array only hold real numbers?
from array import array x=array('f',('hi','hello')) print(x) #output=TypeError: must be real number,not str.
1 Antwort
+ 4
This is also allowed. It is a sample out of the official python documentation:
from array import array
array('l')
array('u', 'hello \u2641')
array('l', [1, 2, 3, 4, 5])
array('d', [1.0, 2.0, 3.14])