$ tar xfz Django-x.xx.tar.gz $ cd Django-x.xx $ sudo python setup.py install
or in Debian Distributions,
$ sudo apt-get install python-django
You can test your installation by running this command:
$ django-admin.py --version
C++, Java, Python, PHP, Programming Tips, Linux, Bash Shell Scripting, Security And Tech Stuff
$ tar xfz Django-x.xx.tar.gz $ cd Django-x.xx $ sudo python setup.py install
$ sudo apt-get install python-django
$ django-admin.py --version
import bz2
import bz2
x = raw_input("Enter Text To Encrypt: ")import bz2
x = raw_input("Enter Text To Encrypt: ")
y = bz2.compress(x)That is it. Now the variable 'x' is encrypted and stored in the variable 'y'.import bz2
x = raw_input("Enter Text To Encrypt: ")
y = bz2.compress(x)
z= bz2.decompress(y)import base64
x = raw_input("Enter Text To Encrypt: ")
base64.b64encode(x)import base64
x = raw_input("Enter Text To Encrypt: ")
y = base64.b64encode(x)
z = base64.b64decode(y)import base64, bz2
x = raw_input("Enter Text To Encrypt: ")
y = base64.b64encode(x)
z = bz2.compress(x)Now you can have a bit more security if you do not want your code released.
Storage
Many of you want to store information (or variables) from one program so another can use it later on. Well, the Pickle Module is great for that. It stores data in a way that only the Pickle Module can read. Pickle is great, but a faster version was created, cPickle. They work the same way, except that cPickle is fast. This module contains a faster reimplementation of the pickle module.
Here is how to load it:
import cPickle as pickle
If that does not work, you will have to use the native Pickle.
import pickle
import cPickle as pickle
x = raw_input("Text you want stored: ")import cPickle as pickle
x = raw_input("Text you want stored: ")
pickle.dump(x, open("stored.p", "w"))When you run this code, you will see the file 'stored.p' appear in the current directory. You will not be able to open it, it is used for pickle.To read the information stored in the file, use the following code:
import cPickle as pickle
x = raw_input("Text you want stored: ")
pickle.dump(x, open("stored.p", "w"))
y = pickle.load(open("stored.p"))Note** I stored the loaded *.p file as 'y'.This method is a great storage method. It is fast, and the *.p files cannot be read without pickle. It can also help to protect your code.Making a *.pyc fileMany of you fear that if you leave your program as a *.py file, the source will be ripped, without credits. Well, another safety precaution is making it a *.pyc file. Automatically, a *.py file is created a a *.pyc the first time it is called upon (or imported).So to create a *.pyc file, make a new file, and import the according *.py file you want converted to *.pyc.Example:I have a file, myCode.py, that I want as a *.pyc file. So I create a new file and type:Save that file in the same directory as the *.py file you want converted.Run it, and the program will now also be in *.pyc form!Note** For those worried, you will still have the *.py file.Also, you will have to delete the *.pyc everytime you want to update the *.py. You have to delete the *.pyc, close Python COMPLETELY. Then run it again with the updated features and it will make a new *.pyc. You will have to do this every time you update your program. Otherwise you will be like "I just fixed that! Why is it still doing the same thing?!" Single *.exe file ..............Tutorial on this available soon!
$ chmod a+x helloworld.py $ ./helloworld.py Hello World
First, we have to give the program executable permission using the chmod command then run the source program.The chmod command is used here to change the mode of the file by giving execute permission to all users of the system. Then, we execute the program directly by specifying the location of the source file. We use the ./ to indicate that the program is located in the current directory.