can someone give me a tut on how to read files like this:

charactor {
    name = "name"
    race = "human"
    ## ect..
}

any and all help will be appreciated :)

Recommended Answers

All 3 Replies

Usually if you want to save something like a dictionary you will use something along the lines of pickle, what that does is it saves the dictionary/class/anything practically using an algorithm and then you can load that file again and the dictionary/class/anything will be back like you had it before.

Here is a thread describing the use of pickle
http://www.daniweb.com/forums/showthread.php?t=172900

i want it to stores name ect. as items in a dictionary

Okay, so that will store it fine. not quite in a readable state. But really what exactly do you want? Do you need to read the file as a text. Do you need to load it back into python. Cause at the moent i dont see exactly why pickle wouldn't do.

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.