with open(“filename.txt”, ‘r’) as f:
content = f.readlines()
# strip() 함수를 이용해 공백 및 줄바꿈 문자를 제거한다.
content = [x.strip() for x in content]
print(content)
'파이썬' 카테고리의 다른 글
리스트의 중복 값 제거 (0) | 2020.02.03 |
---|
with open(“filename.txt”, ‘r’) as f:
content = f.readlines()
# strip() 함수를 이용해 공백 및 줄바꿈 문자를 제거한다.
content = [x.strip() for x in content]
print(content)
리스트의 중복 값 제거 (0) | 2020.02.03 |
---|
댓글