When I am processing the data, I put them inside some beautiful data structure for convenience, but then again I am done with my work, and I want to save the result in hard drive, I need to store them in a txt file, and for later usage, I need to write them in a structured way(in text form).
And then again I need to use the data processed, which was store in a txt file, I need to read it again and I need to write code to store them in some data structure.

Isn't this non sense?

You save your entire data with module pickle. Here is an example ...

# use module pickle to save/dump and load a dictionary object
# or just about any other intact object
# use binary file modes "wb" and "rb" to make it work with
# Python2 and Python3

import pickle

# create the test dictionary
before_d = {}
before_d[1]="Name 1"
before_d[2]="Name 2"
before_d[3]="Name 3"

# pickle dump the dictionary
fout = open("dict1.dat", "wb")
# default protocol is zero
# -1 gives highest prototcol and smallest data file size
pickle.dump(before_d, fout, protocol=0)
fout.close()

# pickle load the dictionary
fin = open("dict1.dat", "rb")
after_d = pickle.load(fin)
fin.close()

print(before_d)  # {1: 'Name 1', 2: 'Name 2', 3: 'Name 3'}
print(after_d)   # {1: 'Name 1', 2: 'Name 2', 3: 'Name 3'}

it seems great! I will try it later~ thanks!

hi diz sahiti, i actually didnt understand wat u wrote,im new 2 dis forum, hey can u tel m abt get( ) function in C............

@ Sahiti:
Please learn netiquette and some english, not "eubonics", or "txtspeak" on online forums. While we will help you, we would like if you spoke as you would in a normal conversation. Also, if you need help with the 'C' syntax/language, please ask in the appropriate forum.
Thank you :D

commented: nice way to handle this +10

im sorry ,i will never repeat this again..............:$

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.