Editing strings in a list of lists

后端 未结 5 703
一向
一向 2021-01-23 08:50

I\'ve made a list of lists from a text block where each list contains all the words in a line as a separate element, like this:

listoflists = [[\'Lorem\', \'ipsu         


        
5条回答
  •  北恋
    北恋 (楼主)
    2021-01-23 09:03

    Also, the reason your original code does not work is b/c n.strip('\n') does not change the value of n. It returns a new string. If you did something like n=n.strip('\n'); return n, that would work.

提交回复
热议问题