How to add a label to all words in a file? [closed]

If I understand the correct output format word-O, you can try something like this:

words = open('filename').read().split()
labeled_words = [word+"-O" for word in words]

# And now user your output format, each word a line, separate by tabs, whatever.
# For example new lines
with open('outputfile','w') as output:

Leave a Comment