what is the best module /package in python to use des /3des for encryption /decryption. could someone provide example to encrypt data with des/3des on python.
You can use the M2Crypto Python wrapper for OpenSSL. It has the advantage of being fast (as fast as OpenSSL), but the disadvantage of the documentation being limited.
Here is the example from my answer to "How to 3DES encrypt in Python using the M2Crypto wrapper?"
with open(keyfile, 'rb') as f:
key = f.read()
encrypt = 1
cipher = Cipher(alg='des_ede3_ecb', key=key, op=encrypt, iv='\0'*16)
ciphertext = cipher.update(plaintext)
ciphertext += cipher.final()