문자열1 [Python3_Error] str(문자열) 연결 에러 상황 1) print()문을 사용해 문장(문자열)을 출력하던 중이었습니다. 2) 사용 코드는 다음과 같습니다. name = python age = 1 hobby = coding print(name + "는" + age + "살이며,", hobby, "을 아주 좋아해요" ) 3) 에러 발생 (문자형이 아닌 모든 경우에) TypeError: can only concatenate str (not "int") to str TypeError: can only concatenate str (not "bool") to str 해석 str(문자열)에는 str만 이을 수 있다. (not int) ( concatenate : 사슬처럼 잇다 ) 해결 숫자형 변수로 선언한 age를 문자열로 치환해주면 될 것 같습니다. str.. 2022. 10. 18. 이전 1 다음