Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 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
|
||||
>>>
|
||||
2
Task/Variable-size-Get/Python/variable-size-get-2.py
Normal file
2
Task/Variable-size-Get/Python/variable-size-get-2.py
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
import sys
|
||||
sys.getsizeof(obj)
|
||||
Loading…
Add table
Add a link
Reference in a new issue