# Fibonacci series # Using Multiple assignments and keyword argument end # the sum of two elements defines the next a, b = 0, 1 while a < 10: print(a, end=' ') a, b = b, a+b
The pickle module is used to serialize and de-serialize the data available in collections like and dictionary Use dump() function to save data from memory to the disc in some file (serialization) Use load() function load data from disc to memory (de-serialization) >>> names=["Vikas","Kapil","Neeraj"] >>> names ['Vikas', 'Kapil', 'Neeraj'] >>> import pickle >>> f1=open("names","wb") >>> pickle.dump(names,f1) >>> f1.close() >>> f2=open("names","rb") >>> mynames=pickle.load(f2) >>> f2.close() >>> mynames ['Vikas', 'Kapil', 'Neeraj'] >>> names==mynames True
Install the module pip install cx_Oracle Import the module import cx_Oracle Establish the connection cn = cx_Oracle.connect('userid/password@servername') #rest commands are same as MySQL
Comments
Post a Comment