I have a txt file to which i want to split on the basis of new line. i write code then find error in it and help me. code is
file = open("C:/Python26/trigram.txt");
f = open("Prefix.txt",'w');
f_up = open("Prefix.txt",'w');
contents=file.read();
tokens = nltk.word_tokenize(contents);
for t in tokens:
print t
my file looks like this:
IL-2$gene$expression$and
IL-2$gene$expression$and$NF-kappa
IL-2$gene$expression$and$NF-kappa$B
IL-2$gene$expression$and$NF-kappa$B$activation
gene$expression$and$NF-kappa$B$activation$through
expression$and$NF-kappa$B$activation$through$CD28