How does one go about a for loop and changing the entries in the list? Like, the equivalent of [line.strip() for line in lines]
, except that line.strip()
is saved back to the lines list.
This is needed because I am using a large dataset, stored in the list. This dataset will be used to for machine training to train a classifier. Specifically, natural language processing using the NLTK lib. Hence, duplication of the array is not feasible.