알고리즘

python

[Troubleshooting] sys.stdin.readline() 꼭 개행문자 제거하자!

문제상황: 다음과 같이 코드를 작성했을 때 출력결과가 이상하게 줄바꿈이 자꾸 되는 것이다!! for key, value in sorted(files.items()): print(key, str(value)) 시도 원인을 파악하려고 몇가지 방법을 시도해봤다 print문 변경 ---> 결과 똑같음,, print(key + " " + str(value)) print("{} {}".format(key, str(value))) print문 뒤에 end="" 추가 print(key, str(value), end="") 흠.. 아무래도 key 값을 출력할 때만 줄바꿈이 들어가는 것 같다..?? 확인해보자! for key, value in sorted(files.items()): print("===" + str(key..

jooyeongmee
'알고리즘' 태그의 글 목록