강의

멘토링

로드맵

Inflearn Community Q&A

jhryu12089922's profile image
jhryu12089922

asked

Getting Started with Programming: Introduction to Python (Inflearn Original)

File Wirte(2-1): CSV files are not unfamiliar, right?

해당 예제에서 줄바꾸기 질문입니다.

Written on

·

281

0

위와 같이 코드를 작성하면 key와 value가 자동으로 줄바꿈이 처리가되서 출력이되는점이 궁금합니다.

for구문에서 순차적으로 k와 v를 받아오고, 같은 print문에서 출력이되는데 어떻게 줄바꿈이 시행되는건가요??

python

Quiz

71% of people got it wrong. Give it a try!

What happens when a file is opened in write mode ('w')?

Content is added at the end of the file.

The existing content of the file is erased and new content is written.

Both read and write modes are activated.

If the file cannot be opened, an error occurs.

Answer 2

0

RYU님의 프로필 이미지
RYU
Questioner

print(k,v) 를 print(k) print(v) 처럼 생각하면되는건가요??

0

niceman님의 프로필 이미지
niceman
Instructor

안녕하세요.

for c in reader 구문을 보면

딕셔너리 한 라인씩 불러오게 되고 그 아래에서 for 구문을 사용해서 k, v

를 실행하게 됩니다.

그 후 print문 실행 -> 다시 reader 구문 실행으로 줄바꿈이 완료가 되는거예요.

jhryu12089922's profile image
jhryu12089922

asked

Ask a question