[Tutor] fine in interpreter, hangs in batch

Switanek, Nick nswitanek at stanford.edu
Fri Mar 16 20:31:04 CET 2007


Hi,

After creating a list of words ('wordlist'), I can run the following
code in the interactive window of PythonWin in about ten seconds. If I
run the script containing the code, the script seems to hang on the
loop. I'd be grateful for help as to why; I often seem to have something
that works in the interpreter, but not when I run the script.

Thanks in advance,
Nick


N = [2,3,4,5]
ngramlist = [wordlist]
for n in N:
    ngrams = [' '.join(wordlist[i:i+n]) for i in
range(len(wordlist)-n+1)]
    "Finished the %d-gram list." % n


More information about the Tutor mailing list