Possible Duplicate:
how to extract a text file into a dictionary
I have a text file where I would like to change it into a dictionary in python. The text file is as follows. Where I would like to have the keys as "sun" and "earth" and "moon" and then for the values the orbital radius, period and such so that I can implement an animation solar system into quickdraw.
RootObject: Sun
Object: Sun
Satellites: Mercury,Venus,Earth,Mars,Jupiter,Saturn,Uranus,Neptune,Ceres,Pluto,Haumea,Makemake,Eris
Radius: 20890260
Orbital Radius: 0
Object: Earth
Orbital Radius: 77098290
Period: 365.256363004
Radius: 6371000.0
Satellites: Moon
Object: Moon
Orbital Radius: 18128500
Radius: 1737000.10
Period: 27.321582
My code so far is
def file():
file = open('smallsolar.txt', 'r')
answer = {}
text = file.readlines()
print(text)
text = file()
print (text)
I'm not sure what do now. Any ideas?