옥탑방주인/Python
Python3 Error : TypeError: 'newline' is an invalid keyword argument for this function
옥탑방주인
2018. 4. 5. 20:16
대학원 강의를 듣던 도중 이러한 에러를 마주치게 되었다.
Traceback (most recent call last): File "chap01_161.py", line 8, in <module> with open(input_file, 'r', newline='') as filereader: TypeError: 'newline' is an invalid keyword argument for this function |
코드는 그저 txt 확장자로 되어있는 파일을 읽어와서 출력하는 내용밖에 없었다.
소스코드 내용
|
설치된 Python version은 3.4버전인가 그렇다.
terminal로 코드를 실행하려고 python file.py filePath를 입력하였으나... 실행불가
이리저리 구글링 해보니 실행할 때 python3 file.py filePath로 해보라고 나와있어서 바로 적용해보았다.
이 오류는 바로 해결되었다 ㅡ.ㅡㅋ