I'm quite new to python and wondering if I can convert the following for loop in to a one line of code in pythonic way:
w_topic = []
for line in lines: #lines is a list of strings
word,topic = itemgetter(4,5)(line.split())
w_topic.append((word,topic))
I have looked at list comprehensions but not sure how to apply it here? it is possible in one line? how do I know if something is doable is one line in the pythonic way?
[(w,t) for w,t in how to fill here?]