问题是我无法获取图像文件
如何同时使用utf-8和base64来使图像和文本同时显示...
##
import socket
import base64
server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server_socket.bind(('127.0.0.1', 8080))
server_socket.listen(1)
print('listening')
while True:
connect_socket, addr = server_socket.accept()
data = connect_socket.recv(99999)
print('data received : ',data.decode())
connect_socket.sendall("""HTTP/1.1 200 OK
<head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
<meta http-equiv="Content-Type" content="image/jpeg;charset=UTF-8" />
<title>Happy pig</title>
</head>
<body>
<font color=#55C0F1 size=10>
<h1>
"Hi"
<img src="pig.jpg" width= "137" height="150">
</h1>
</font>
</form>
</body>
</html>""".encode('utf-8'))
connect_socket.close()
##