help( ) : command is used to get details of function or statement from python inbuild library. Eg . print
help(' ') : To get information about operators . Eg . return
To get info about the variable used , import the module and get help
eg . import math
a = 4
help(a)
to get the type of the variable use : type ( ) . Eg type(a)
To get a reverse of a line from a file
f = open('word.txt')
while True:
line = f.readline()
if len(line) == 0:
break
print(line)
print line[::-1]
f.close
while True:
line = f.readline()
if len(line) == 0:
break
print(line)
print line[::-1]
f.close
Its Easy to install Fedora 14 along with Windows as a dual OS.
Click on the default buttons untill the installation type screen appears .
-> After choose Shrink Current System option .
->Or choose Replace Existing Linux System option. [Note: If a linux OS previously installed this method removes it.
[slideshow]
By Choosing this we need not create partions of it. After selecting the option click the default buttons which enable us to complete the fedora installation.
-> After choose Shrink Current System option .
->Or choose Replace Existing Linux System option. [Note: If a linux OS previously installed this method removes it.
[slideshow]
By Choosing this we need not create partions of it. After selecting the option click the default buttons which enable us to complete the fedora installation.
To Find Palindrome or Not
x = raw_input("enter the word to test palindrome:")
a = x[::-1]
if x==a :
print("The word is palindrome")
else:
print("The word is not a palindrome")
a = x[::-1]
if x==a :
print("The word is palindrome")
else:
print("The word is not a palindrome")
Keyboard Shortcuts : Linux
to see the contents of the current location through terminal : ls
to change the directory : cd (destination name)
also can use to change the directory : cd {space}{tab}
to locate a file with space in its name use \ then press the number of space used and then the name of file : eg python\ prog
to exit from terminal : ctrl+shift+d
to exit from current location : ctrl+d
to open editor in terminal : vi or vim with the name of the file .
: to execute given extention , eg like py.
to quit editor : esc : q
to save : esc :w
to quit and save : esc :wq
to change the directory : cd (destination name)
also can use to change the directory : cd {space}{tab}
to locate a file with space in its name use \ then press the number of space used and then the name of file : eg python\ prog
to exit from terminal : ctrl+shift+d
to exit from current location : ctrl+d
to open editor in terminal : vi or vim with the name of the file .
: to execute given extention , eg like py.
to quit editor : esc : q
to save : esc :w
to quit and save : esc :wq
To convert to celcius of farenheit.
x = int(raw_input("enter the value to be converted :"))
thevalue = raw_input('c or f')
if thevalue == 'f':
print 'f == %d' % (9/5*(x+32))
elif thevalue == 'c':
print 'c == %d' % (5/9*(x-32))
thevalue = raw_input('c or f')
if thevalue == 'f':
print 'f == %d' % (9/5*(x+32))
elif thevalue == 'c':
print 'c == %d' % (5/9*(x-32))
How to install Django in virtual environment at fedora !
sudo easy_install python : To get the python packages
easy_install virtualenv : To install the virtual environment
source bin/activate : To activate the virtual environment.
sudo wget http://www.djangoproject.com/download/1.3/tarball/ : To download the Django in the virtual environment
tar xzvf Django-1.3.tar.gz : to remove the tar file
cd Django-1.3 : to change the directory
easy_install virtualenv : To install the virtual environment
source bin/activate : To activate the virtual environment.
sudo wget http://www.djangoproject.com/download/1.3/tarball/ : To download the Django in the virtual environment
tar xzvf Django-1.3.tar.gz : to remove the tar file
cd Django-1.3 : to change the directory
sudo python setup.py install : the install destination
To check Django is installed !
To check Django is installed or not !
use the command :
import django
print django.get_version()
output:
(the version been installed eg ;-) 1.25
use the command :
import django
print django.get_version()
output:
(the version been installed eg ;-) 1.25
Subscribe to:
Posts (Atom)