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.