SyntaxFix
Write A Post
Hire A Developer
Questions
my_list = ['this\n', 'is\n', 'a\n', 'list\n', 'of\n', 'words\n'] print([l.strip() for l in my_list])
Output:
['this', 'is', 'a', 'list', 'of', 'words']