Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Python

Name: Anonymous 2011-01-23 14:50

Newbie to Python here

I made a function that calculates distribution of certain characters in any given text file and saves them in another *.txt file like so 'character' + '\t' + percentage + '\n'
And now I'm trying to write the characters and their distribution percentages from that *.txt file to a new dictionary which takes the character as keys, and percentages as values.

I can't figure out how to transfer the files from that document to the dictionary...

to visualize:

def read_dist(filename):
dictdist={}
#### This part here ####
return dictdist

Name: Anonymous 2011-01-23 14:58

Come on give me a fucking break

Name: Anonymous 2011-01-23 15:07

>>5
Well thanks I guess
Only thing is that I can't use .strip() because the character cluster may start with a space. All I really need to remove are the '\n' next line commands.

Name: Anonymous 2011-01-23 19:06

Lack of [code] tags?
He didn't indent his FIOC code.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List