|
Basic String Printing |
|
|
|
|
Wednesday, 14 December 2011 |
|
Here's a quick example how to print strings in Python:
print strings #!/usr/local/bin/python name = "John" address = "Main Street 10" print "Name is %s, Address is %s." % (name, address ) print "Name is", name, "Address is", address print "Name is " + name + " Address is ", address |
|
Find Location of Your Installed Python Modules |
|
|
|
|
Tuesday, 13 December 2011 |
|
Python comes with some modules (libraries). You can find where are those modules located with the following commands.
python
Then at python console:
>>> import sys >>> print sys.path
On a Centos 6.0 you will get something like this:
print sys.path # command ['', '/usr/lib64/python26.zip', '/usr/lib64/python2.6', '/usr/lib64/python2.6/plat-linux2', '/usr/lib64/python2.6/lib-tk', '/usr/lib64/python2.6/lib-old', '/usr/lib64/python2.6/lib-dynload', '/usr/lib64/python2.6/site-packages', '/usr/lib/python2.6/site-packages', '/usr/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg-info'] The output of the command contans the directories that are searched for python modules. |
|
Last Updated ( Tuesday, 13 December 2011 )
|
|