把每一行txt变成带字符串的list

Turn every line of txt into list with strings

如何将txt文件的每一行变成字符串列表

例句

board games for kids
house with view on the sea

我需要这样的输出 python

sentences = ["board games for kids ","house  with view on the sea"]
with open('file.txt','r') as f:
    sentences = list(f)

或者如果你不想要最后的 \n 就做

with open('file.txt','r') as f:
    sentences = [line[:-1] for line in f]

lines = [line.rstrip() for line in open('file.txt')]