[PyMysql] TypeError: can only concatenate str (not "NoneType") to str
728x90
SMALL

뜻 그대로이다. string 타입에 string 타입이 아닌 변수를 concatenation 할 수 없다.

 

나의 경우는 

w_file.write("> " + cname + ' ' + cid + ' ' + bid + ' ' + mno + ' ' + type + ' ' + rentaldate + "\n")

 

이 코드에서 에러가 발생했다.

rentaldate의 type은 date인데, 이 앞은 string이므로 당연히 concatenate 할 수 없기 때문이다.

 

w_file.write("> " + cname + ' ' + cid + ' ' + bid + ' ' + mno + ' ' + type + ' ' + str(rentaldate) + "\n")

이렇게 수정하여 해결했다.

 

 

 

 

728x90
LIST