View Single Post
Old 12-06-2012, 01:42 PM   #6
BlackEleven
Redundant Minister of Redundancy
 
BlackEleven's Avatar
 
Join Date: Apr 2004
Location: Montreal
Exp:
Default

Oh right, didn't think about the newlines.

Perhaps the easiest way is just to iterate line by line. This will give you something to start on:
Code:
communityDict = {}
communityFile = open( filePath, "r" )
for line in communityFile.readlines():
   if ( "community" in line ):
      communityDict[ line.split("community")[0].strip() ] = line.split("community")[1].strip()
Edit: Disclaimer: I didn't try this nor am I a Python programmer ( I do C++), this is off the top of my head.

Last edited by BlackEleven; 12-06-2012 at 01:46 PM.
BlackEleven is offline   Reply With Quote