all tasks
This commit is contained in:
parent
b83f433714
commit
68f8f3e56b
14735 changed files with 178959 additions and 0 deletions
15
Task/Variable-size-Get/Python/variable-size-get-1.py
Normal file
15
Task/Variable-size-Get/Python/variable-size-get-1.py
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
>>> from array import array
|
||||
>>> argslist = [('l', []), ('c', 'hello world'), ('u', u'hello \u2641'),
|
||||
('l', [1, 2, 3, 4, 5]), ('d', [1.0, 2.0, 3.14])]
|
||||
>>> for typecode, initializer in argslist:
|
||||
a = array(typecode, initializer)
|
||||
print a, '\tSize =', a.buffer_info()[1] * a.itemsize
|
||||
del a
|
||||
|
||||
|
||||
array('l') Size = 0
|
||||
array('c', 'hello world') Size = 11
|
||||
array('u', u'hello \u2641') Size = 14
|
||||
array('l', [1, 2, 3, 4, 5]) Size = 20
|
||||
array('d', [1.0, 2.0, 3.1400000000000001]) Size = 24
|
||||
>>>
|
||||
Loading…
Add table
Add a link
Reference in a new issue