"Simon Strobl" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | Any hints?
For future reference, I would consider using sample data in the file itself for debugging -- to separate an algorithm problem from a file problem: | ================================================ | | #!/usr/bin/python | | import sys | | frqlist = open('my_frqlist.txt', 'r') | | # my_frqlist looks like this: | # 787560608|the | # 434879575|of | # 413442185|and | # 395209748|to | # 284833918|a | # 249111541|in | # 169988976|is Change above to: # frqlist = open('my_frqlist.txt', 'r') frqlist = '''\ 787560608|the 434879575|of 413442185|and 395209748|to 284833918|a 249111541|in 169988976|is'''.split('\n') # sample my_frqlist.txt | frq = {} | | for line in frqlist: | line = line.rstrip() | frequency, word = line.split('|') | frq[word] = int(frequency) | | for key in frq.keys(): | print key, frq[key] An alternative is 'print line' in the first loop after stripping. tjr -- http://mail.python.org/mailman/listinfo/python-list