2020
10-10
10-10
Python如何实现机器人聊天
今天午休的时候,无意之中看了一篇博客,名字叫Python实现机器人,感觉挺有的意思的。于是用其写了一个简单的Python聊天,源码如下所示:#-*-coding:utf-8-*-importaimlimportsysimportosdefget_module_dir(name):print("module",sys.modules[name])path=getattr(sys.modules[name],'__file__',None)print(path)ifnotpath:raiseAttributeError('module%shasnotattribute__file__'%name)returnos.pa...
继续阅读 >
本文实例为大家分享了vue.js实现h5机器人聊天的具体代码,供大家参考,具体内容如下<!DOCTYPEhtml><html><head><metacharset="UTF-8"><metaname="viewport"content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/><title>登录</title><linkrel="stylesheet"href="css/mui.css"/></head><style>page{background-color:#ececec;}.reply.pic,.send.pic{border...
b2b模式的聊天工具服务端:#链接whileTrue:print('等待连接...')sock,adr=server_socket.accept()whileTrue:try:#接受数据data=sock.recv(1024)print(adr[0]+'发来消息:',data.decode())#发送数据send_msg=input("请输入发送内容>>").strip()sock.send(send_msg.encode('utf-8'))exceptConnectionResetErrorase:print('%s断开连接!'%adr[0])break#关闭本次连接sock.close()...