Difference between revisions of "Python"

From LPTMS Wiki
Jump to: navigation, search
m (Tips)
m
Line 8: Line 8:
 
* [http://www.unixgarden.com/index.php/programmation/python-et-le-c Python et le C]
 
* [http://www.unixgarden.com/index.php/programmation/python-et-le-c Python et le C]
  
== Libraries ==
+
== Libraries and softwares ==
  
 
* [http://ipython.org iPython]
 
* [http://ipython.org iPython]
 +
* [http://ipython.org/ipython-doc/dev/interactive/htmlnotebook.html the iPython notebook] (interface similar to Mathematica) use HTML to handle worksheets.
 
* [http://docs.python.org/library Standard Library]
 
* [http://docs.python.org/library Standard Library]
 
* [http://scipy.org SciPy] - [http://numpy.scipy.org NumPy]
 
* [http://scipy.org SciPy] - [http://numpy.scipy.org NumPy]

Revision as of 10:58, 24 April 2012

documentation

Libraries and softwares

Miscellaneous

Tips

  • equivalent of the C ternary operator ?: (bool ? restrue : resfalse), use a tuple

(resfalse,restrue)[bool]
  • adding a path to a directory containing your module files

import sys
sys.path += [ "/home/username/bin/Python" ]
  • test whether a string has only digits or letters

str = '1321'
str.isdigit() # returns True/False
str.isalpha() # returns True/False