인프런 커뮤니티 질문&답변
리스트의 값을 print로 출력 관련 질문입니다.
작성
·
257
0
같은 end=""로 해도 1번은 한줄씩 출력이 되고
2번은 한줄에 전부 값이 출력 되는데 차이점을 잘 모르겠네요
1. 파일 내용을 리스트에 담아서 값을 출력
score_file = open("score.txt", "r", encoding="utf8")
lines = score_file.readlines()
for line in lines:
print(line, end="")
score_file.close()
결과
math:0
eng:50
---------------------------------------
2. 리스트의 값을 출력
sample = [1,2,3,4,5,6,7]
for id in sample:
print(id, end="")
결과
1234567





