test.txt:
孔老二
罪恶的
一生
with open('test.txt', encoding = 'utf-8') as f:
lines = f.readlines()
lines:
['孔老二\n', '罪恶的\n', '一生']
with open('test.txt', encoding = 'utf-8') as f:
lines = f.readlines()
lines = [x.strip() for x in lines]
lines:
['孔老二', '罪恶的', '一生']