本文实例为大家分享了python3.5基于TCP实现文件传输的具体代码,供大家参考,具体内容如下
服务器代码
# _*_ coding:utf-8 _*_
from socket import *
import _thread
def tcplink(skt,addr):
print(skt)
print(addr,"已经连接上...")
print('开始发送文件')
with open('./ww.jpg', 'rb') as f:
for data in f:
本文实例讲述了Python基于TCP实现会聊天的小机器人功能。分享给大家供大家参考,具体如下:
一 代码
1、服务端程序
import socket
words ={'how are you?':'Fine,thank you.',
'how old are you?':'38',
'what is your name?':'Dong FuGuo',
"what's your name?":'Dong FuGuo',
'where do you work?':'SDIBT',
'bye':'B