How to split each words from several lines of a word file? (python)

前端 未结 3 1382
一整个雨季
一整个雨季 2021-01-28 10:32

I have a text file:

But soft what light through yonder window breaks
It is the east and Juliet is the sun
Arise fair sun and kill the envious moon
Who is already          


        
3条回答
  •  攒了一身酷
    2021-01-28 10:51

    output = []
    with open('file_name') as f:
        for i in f.readlines():
            for j in words_to_split:
                i = ''.join(i.split(j))
            output.append(i)
    

提交回复
热议问题