본문 바로가기

컴터 때찌/Error

[python] Try to replace "XXX" by b"XXX" if you are using Python 3.x

s.send('GET / HTTP/1.1\r\n')

TypeError: must be bytes or buffer, not str

s.send(b'GET / HTTP/1.1\r\n')
s.send(b'Host: test.kr\r\n')
s.send(b'\r\n')

link = http://stackoverflow.com/questions/2411864/python-socket-send-buffer-vs-str