for l in f:
w1, w2 = l.strip().split('\t')
I'm doing computerized text analysis in Python. This is the original code for splitting bigram elements (words) in a list of bigrams deemed significant (and the overall code is of course longer and incorporates appending the words later, but this is the problematic part of it). For bigrams it works perfectly, but I would like to implement this also for ngrams of more word elements like trigrams and fourgrams. But of course
for l in f:
w1, w2, w3, w4 = l.strip().split('\t')
doesn't work.
What would be a good alternative in this scenario?
Thank you for the answers in advance!