User Tools

Site Tools


cs_lang:python:things-to-know:native-datatypes

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
cs_lang:python:things-to-know:native-datatypes [2010/12/12 18:31] cedriccs_lang:python:things-to-know:native-datatypes [2011/01/11 14:26] (current) cedric
Line 11: Line 11:
 ====== Booleans ====== ====== Booleans ======
 <code python> <code python>
 +>>> x = 42
 +>>> 19 <= x <= 51
 +True
 +>>> 19 <= x <= 41
 +False
 +>>> 
 >>> 0 == False >>> 0 == False
 True True
Line 31: Line 37:
 </code> </code>
  
 +<code python>
 +>>> import this
 +>>> love = this
 +>>> this is love
 +True
 +>>> love is True
 +False
 +>>> love is False
 +False
 +>>> love is not True or False
 +True
 +>>> love is not True or False; love is love
 +True
 +True
 +</code>
  
 ====== Numbers ====== ====== Numbers ======
Line 135: Line 156:
   File "<stdin>", line 1, in <module>   File "<stdin>", line 1, in <module>
 KeyError: 'blog' KeyError: 'blog'
->>> a_dict['blog'] = 'dotclear+>>> 'blog' in a_dict 
 +False 
 +>>> a_dict['blog'] = 'wordpress
 >>> a_dict >>> a_dict
 {'blog': 'dotclear', 'database': 'mysql', 'server': 'cedricbonhomme.org'} {'blog': 'dotclear', 'database': 'mysql', 'server': 'cedricbonhomme.org'}
cs_lang/python/things-to-know/native-datatypes.1292175110.txt.gz · Last modified: 2010/12/12 18:31 by cedric