Convert text into a dictionary with certain keys and values [duplicate]
问题 This question already has answers here : Closed 7 years ago . 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