Tuesday, September 25, 2007

[learning Python] built-in objects preview

Built-in objects preview

Object type
Example literals/creation


Numbers
3.1415, 1234, 999L, 3+4j


Strings
'spam', "guido's"


Lists
[1, [2, 'three'], 4]


Dictionaries
{'food': 'spam', 'taste': 'yum'}


Tuples
(1,'spam', 4, 'U')


Files
text = open('eggs', 'r').read( )

No comments :