Use Pickle to save and read,picklesave,import pickl
Use Pickle to save and read,picklesave,import pickl
import pickledFile = open('storage.dat', 'wb')x = 123.467pickle.dump( x,dFile )y = 10pickle.dump( y,dFile )z = { 1 : 'Hello', 2 : 'Goodbye' }pickle.dump( z, dFile )dFile.close()iFile = open('storage.dat', 'rb' )d1 = pickle.load(iFile)print d1d2 = pickle.load(iFile)print d2d3 = pickle.load(iFile)print d3iFile.close()print 'Done'
- Find a word in shelve file,findshelve,import sys,
- hex literals,literals,print 0x01,
- Reading a binary File,readingbinaryfile,f = open('/m
- Slicing works similar to strings; use the square bracket
- Read a file line by line and check line separator,chec
- Looping Over Characters with read Writing the Loop Diffe
热门文章:
相关内容
- Find a word in shelve file,findshelve,import sys,
- hex literals,literals,print 0x01,
- Reading a binary File,readingbinaryfile,f = open('/m
- Slicing works similar to strings; use the square bracket slice operat
- Read a file line by line and check line separator,checkseparator,im
- Looping Over Characters with read Writing the Loop Differently,loop
- Text files: iterating over the lines in the file,iteratinglines,f =
- Reading the entire file at once,readingentire,print '\nRea
- Creating a text file with the writelines() method.,creatingwritelin
- Dates are easily constructed and formatted,,#Dates and T
评论关闭