├── Pytorch学习笔记.ipynb ├── README.html ├── README.md ├── RP └── Recommendation_Systems_Colab.ipynb ├── _config.yml ├── data ├── female_text.txt └── fig │ ├── 437500002015479e1678.gif │ ├── coding_life.jpg │ └── vim.jpg ├── demo ├── SARI │ ├── bdd_ncov.ipynb │ └── sari.ipynb ├── computer.py ├── face_recognition │ ├── data │ │ ├── obama.png │ │ ├── test2.jpg │ │ └── wqw.jpg │ └── face_recog_test.py ├── itchat │ ├── auto-reply.py │ ├── itchat-test.ipynb │ ├── itchat.ipynb │ ├── itchat.pkl │ ├── wechat.xls │ └── wechat_robot │ │ ├── auto_replay.py │ │ ├── auto_tuling.py │ │ ├── chatbot.py │ │ ├── chatbot_compitition.jpg │ │ └── wechat_control.py └── skin_detect │ ├── data │ ├── 0.jpg │ └── 1.jpg │ ├── detect.py │ ├── output │ ├── 0_Nude.jpg │ └── 1_Normal.jpg │ └── readme.ini ├── jupyter ├── Scikit-learn学习笔记.ipynb ├── TensorFlow_note.ipynb ├── analysis.ipynb ├── cluster_job.ipynb ├── draw.ipynb ├── model.ipynb ├── scikit-learn-example.ipynb ├── test_pandas_numpy.ipynb ├── text_process.ipynb └── word2vec.ipynb ├── other └── figure │ ├── mmexport1563449034348.jpg │ ├── readme.md │ └── wqw.png ├── python ├── cws.py ├── get_lianjie.py ├── mysql_test.py ├── nn_test.py ├── nn_test_1.py ├── nn_test_2.py ├── pandas.py ├── pylint.py ├── python-coding.png ├── python入门神图.jpg ├── samplt.py └── w2v.py ├── qr_code.gif ├── rl ├── Reinforcement-learning-with-tensorflow │ ├── LICENCE │ ├── README.md │ ├── RL_cover.jpg │ ├── contents │ │ ├── 10_A3C │ │ │ ├── A3C_RNN.py │ │ │ ├── A3C_continuous_action.py │ │ │ ├── A3C_discrete_action.py │ │ │ └── A3C_distributed_tf.py │ │ ├── 11_Dyna_Q │ │ │ ├── RL_brain.py │ │ │ ├── maze_env.py │ │ │ └── run_this.py │ │ ├── 12_Proximal_Policy_Optimization │ │ │ ├── DPPO.py │ │ │ ├── discrete_DPPO.py │ │ │ └── simply_PPO.py │ │ ├── 1_command_line_reinforcement_learning │ │ │ ├── draw.py │ │ │ ├── treasure_on_right.py │ │ │ └── treasure_on_right_wqw.py │ │ ├── 2_Q_Learning_maze │ │ │ ├── RL_brain.py │ │ │ ├── maze_env.py │ │ │ └── run_this.py │ │ ├── 3_Sarsa_maze │ │ │ ├── RL_brain.py │ │ │ ├── maze_env.py │ │ │ └── run_this.py │ │ ├── 4_Sarsa_lambda_maze │ │ │ ├── RL_brain.py │ │ │ ├── maze_env.py │ │ │ └── run_this.py │ │ ├── 5.1_Double_DQN │ │ │ ├── RL_brain.py │ │ │ └── run_Pendulum.py │ │ ├── 5.2_Prioritized_Replay_DQN │ │ │ ├── RL_brain.py │ │ │ └── run_MountainCar.py │ │ ├── 5.3_Dueling_DQN │ │ │ ├── RL_brain.py │ │ │ └── run_Pendulum.py │ │ ├── 5_Deep_Q_Network │ │ │ ├── DQN_modified.py │ │ │ ├── RL_brain.py │ │ │ ├── maze_env.py │ │ │ └── run_this.py │ │ ├── 6_OpenAI_gym │ │ │ ├── RL_brain.py │ │ │ ├── run_CartPole.py │ │ │ └── run_MountainCar.py │ │ ├── 7_Policy_gradient_softmax │ │ │ ├── RL_brain.py │ │ │ ├── run_CartPole.py │ │ │ └── run_MountainCar.py │ │ ├── 8_Actor_Critic_Advantage │ │ │ ├── AC_CartPole.py │ │ │ └── AC_continue_Pendulum.py │ │ ├── 9_Deep_Deterministic_Policy_Gradient_DDPG │ │ │ ├── DDPG.py │ │ │ ├── DDPG_update.py │ │ │ └── DDPG_update2.py │ │ └── Curiosity_Model │ │ │ ├── Curiosity.png │ │ │ ├── Curiosity.py │ │ │ └── Random_Network_Distillation.py │ └── experiments │ │ ├── 2D_car │ │ ├── DDPG.py │ │ ├── car_env.py │ │ └── collision.py │ │ ├── Robot_arm │ │ ├── A3C.py │ │ ├── DDPG.py │ │ ├── DPPO.py │ │ └── arm_env.py │ │ ├── Solve_BipedalWalker │ │ ├── A3C.py │ │ ├── A3C_rnn.py │ │ ├── DDPG.py │ │ └── log │ │ │ └── events.out.tfevents.1490801027.Morvan │ │ └── Solve_LunarLander │ │ ├── A3C.py │ │ ├── DuelingDQNPrioritizedReplay.py │ │ └── run_LunarLander.py ├── openai │ ├── gym-dqn.py │ ├── gym_hello.py │ └── gym_test.py ├── readme.md └── ucl │ └── test.py ├── web ├── Untitled Diagram.drawio ├── location_points_cluster_view.html ├── pydown │ ├── pydown.html │ └── pydown_files │ │ ├── deck.core.css │ │ ├── deck.core.js.下载 │ │ ├── deck.scale.css │ │ ├── deck.scale.js.下载 │ │ ├── deck.status.css │ │ ├── deck.status.js.下载 │ │ ├── horizontal-slide.css │ │ ├── jquery.min.js.下载 │ │ ├── md_hl.css │ │ ├── modernizr.custom.js.下载 │ │ └── web-2.0.css └── timeline │ ├── 643.jpg │ ├── css │ └── about.css │ ├── timeline.html │ └── tl.html ├── 学习资料汇总 └── 微软-ML算法指南.png /_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-hacker -------------------------------------------------------------------------------- /data/fig/437500002015479e1678.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wqw547243068/wangqiwen/07b64ae47d91581e1c339f40bc765fd7815b47ff/data/fig/437500002015479e1678.gif -------------------------------------------------------------------------------- /data/fig/coding_life.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wqw547243068/wangqiwen/07b64ae47d91581e1c339f40bc765fd7815b47ff/data/fig/coding_life.jpg -------------------------------------------------------------------------------- /data/fig/vim.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wqw547243068/wangqiwen/07b64ae47d91581e1c339f40bc765fd7815b47ff/data/fig/vim.jpg -------------------------------------------------------------------------------- /demo/computer.py: -------------------------------------------------------------------------------- 1 | #python中的import语句是用来导入模块的,在python模块库中有着大量的模块可供使用,要想使用这些文件需要用import语句把指定模块导入到当前程序中。 2 | import re#处理字符串的模块,如查找特定字符,删除特定字符,字符串分割等 3 | import tkinter#Tkinter模块("Tk 接口")是Python的标准Tk GUI工具包的接口,位Python的内置模块,直接import tkinter即可使用。 4 | import tkinter.messagebox#调用tkinter模块中的messagebox函数,这个是消息框,对话框的关键,会弹出一个小框 5 | 6 | #按钮操作,点击按钮后需要做的处理 7 | def buttonClik(btn): 8 | content=contentVar.get()#获取文本框中的内容 9 | #如果已有内容是以小数点开头的,在前面加0 10 | if content.startswith('.'): 11 | content='0'+content#字符串可以直接用+来增加字符 12 | #根据不同的按钮作出不同的反应 13 | if btn in '0123456789': 14 | content+=btn#0-9中哪个键按下了,就在content字符串中增添 15 | elif btn=='.': 16 | #re.split,支持正则及多个字符切割 17 | lastPart=re.split(r'\+|-|\*|/',content)[-1]#将content从+-*/这些字符的地方分割开来,[-1]表示获取最后一个字符 18 | if '.'in lastPart: 19 | tkinter.messagebox.showerror('错误','重复出现的小数点')#出现对话框,并提示信息 20 | return 21 | else: 22 | content+=btn 23 | elif btn=='C': 24 | content=''#清除文本框 25 | elif btn=='=': 26 | try: 27 | #对输入的表达式求值 28 | content=str(eval(content))#调用函数eval,用字符串计算出结果 29 | except: 30 | tkinter.messagebox.showerror('错误','表达式有误') 31 | return 32 | elif btn in operators: 33 | if content.endswith(operators):#如果content中最后出现的+-*/ 34 | tkinter.messagebox.showerror('错误','不允许存在连续运算符') 35 | return 36 | content+=btn 37 | elif btn=='Sqrt': 38 | n=content.split('.')#从.处分割存入n,n是一个列表 39 | if all(map(lambda x:x.isdigit(),n)):#如果列表中所有的都是数字,就是为了检查表达式是不是正确的 40 | content=eval(content)**0.5 41 | else: 42 | tkinter.messagebox.showerror('错误','表达式错误') 43 | return 44 | contentVar.set(content)#将结果显示到文本框中 45 | 46 | root=tkinter.Tk()#生成主窗口,用root表示,后面就在root操作 47 | #设置窗口大小和位置 48 | root.geometry('300x270+400+100')#指定主框体大小 49 | #不允许改变窗口大小 50 | root.resizable(False,False)#框体大小可调性,分别表示x,y方向的可变性; 51 | #设置窗口标题 52 | root.title('计算器') 53 | 54 | #文本框和按钮都是tkinter中的组件 55 | #Entry    文本框(单行); 56 | #Button   按钮; 57 | #放置用来显示信息的文本框,设置为只读 58 | #tkinter.StringVar 能自动刷新的字符串变量,可用set和get方法进行传值和取值 59 | contentVar=tkinter.StringVar(root,'') 60 | contentEntry=tkinter.Entry(root,textvariable=contentVar)#括号里面,可见第一个都是root,即表示都是以root为主界面的,将文本框中的内容存在contentVar中 61 | contentEntry['state']='readonly'#文本框只能读,不能写 62 | contentEntry.place(x=10,y=10,width=280,height=20)#文本框在root主界面的xy坐标位置,以及文本框自生的宽和高 63 | #x:     组件左上角的x坐标; 64 | #y:    组件右上角的y坐标; 65 | #放置清除按钮和等号按钮 66 | btnClear=tkinter.Button(root,text='C',bg = 'red',command=lambda:buttonClik('C'))#在root主界面中放置按钮,按钮上显示C,红色,点击按钮后进入buttonClik回调函数做进一步的处理,注意传入了参数‘C’,这样就能分清是哪个按钮按下了 67 | #下面的内容和上面的模式都是一样的 68 | btnClear.place(x=40,y=40,width=80,height=20) 69 | btnCompute=tkinter.Button(root,text='=',bg = 'yellow',command=lambda :buttonClik('=')) 70 | btnCompute.place(x=170,y=40,width=80,height=20) 71 | 72 | #放置10个数字、小数点和计算平方根的按钮 73 | digits=list('0123456789.')+['Sqrt']#序列list是Python中最基本的数据结构。序列中的每个元素都分配一个数字 - 它的位置,或索引,第一个索引是0,第二个索引是1,依此类推。 74 | index=0 75 | #用循环的方式将上面数字、小数点、平方根这12个按钮分成四行三列进行放置 76 | for row in range(4): 77 | for col in range(3): 78 | d=digits[index]#按索引从list中取值,和c语言中的数组类似 79 | index+=1#索引号递增 80 | btnDigit=tkinter.Button(root,text=d,command=lambda x=d:buttonClik(x))#和上面的是类似的 81 | btnDigit.place(x=20+col*70,y=80+row*50,width=50,height=20)#很显然,每次放一个按钮的位置是不一样的,但是它们之间的关系时确定的 82 | #放置运算符按钮 83 | operators=('+','-','*','/','**','//')#Python的元组与列表类似,不同之处在于元组的元素不能修改。 84 | #元组使用小括号,列表使用方括号。 85 | #enumerate() 函数用于将一个可遍历的数据对象(如列表、元组或字符串)组合为一个索引序列,同时列出数据和数据下标,一般用在 for 循环当中。 86 | for index,operator in enumerate(operators): 87 | btnOperator=tkinter.Button(root,text=operator,bg = 'orange',command=lambda x=operator:buttonClik(x))#创建的过程和上面类似 88 | btnOperator.place(x=230,y=80+index*30,width=50,height=20) 89 | 90 | root.mainloop()#进入消息循环(必需组件) 91 | -------------------------------------------------------------------------------- /demo/face_recognition/data/obama.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wqw547243068/wangqiwen/07b64ae47d91581e1c339f40bc765fd7815b47ff/demo/face_recognition/data/obama.png -------------------------------------------------------------------------------- /demo/face_recognition/data/test2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wqw547243068/wangqiwen/07b64ae47d91581e1c339f40bc765fd7815b47ff/demo/face_recognition/data/test2.jpg -------------------------------------------------------------------------------- /demo/face_recognition/data/wqw.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wqw547243068/wangqiwen/07b64ae47d91581e1c339f40bc765fd7815b47ff/demo/face_recognition/data/wqw.jpg -------------------------------------------------------------------------------- /demo/face_recognition/face_recog_test.py: -------------------------------------------------------------------------------- 1 | import face_recognition 2 | import cv2 3 | 4 | # This is a super simple (but slow) example of running face recognition on live video from your webcam. 5 | # There's a second example that's a little more complicated but runs faster. 6 | 7 | # PLEASE NOTE: This example requires OpenCV (the `cv2` library) to be installed only to read from your webcam. 8 | # OpenCV is *not* required to use the face_recognition library. It's only required if you want to run this 9 | # specific demo. If you have trouble installing it, try any of the other demos that don't require it instead. 10 | 11 | # Get a reference to webcam #0 (the default one) 12 | video_capture = cv2.VideoCapture(0) 13 | 14 | # Load a sample picture and learn how to recognize it. 15 | obama_image = face_recognition.load_image_file("data/obama.png ") 16 | obama_face_encoding = face_recognition.face_encodings(obama_image)[0] 17 | 18 | while True: 19 | # Grab a single frame of video 20 | ret, frame = video_capture.read() 21 | 22 | # Find all the faces and face enqcodings in the frame of video 23 | face_locations = face_recognition.face_locations(frame) 24 | face_encodings = face_recognition.face_encodings(frame, face_locations) 25 | 26 | # Loop through each face in this frame of video 27 | for (top, right, bottom, left), face_encoding in zip(face_locations, face_encodings): 28 | # See if the face is a match for the known face(s) 29 | match = face_recognition.compare_faces([obama_face_encoding], face_encoding) 30 | 31 | name = "Unknown" 32 | if match[0]: 33 | name = "Barack" 34 | 35 | # Draw a box around the face 36 | cv2.rectangle(frame, (left, top), (right, bottom), (0, 0, 255), 2) 37 | 38 | # Draw a label with a name below the face 39 | cv2.rectangle(frame, (left, bottom - 35), (right, bottom), (0, 0, 255), cv2.FILLED) 40 | font = cv2.FONT_HERSHEY_DUPLEX 41 | cv2.putText(frame, name, (left + 6, bottom - 6), font, 1.0, (255, 255, 255), 1) 42 | 43 | # Display the resulting image 44 | cv2.imshow('Video', frame) 45 | 46 | # Hit 'q' on the keyboard to quit! 47 | if cv2.waitKey(1) & 0xFF == ord('q'): 48 | break 49 | 50 | # Release handle to the webcam 51 | video_capture.release() 52 | cv2.destroyAllWindows() 53 | -------------------------------------------------------------------------------- /demo/itchat/auto-reply.py: -------------------------------------------------------------------------------- 1 | # -*- coding=utf-8 -*- 2 | import requests 3 | import itchat 4 | import random 5 | # import sys 6 | # reload(sys) 7 | # sys.setdefaultencoding('utf-8') 8 | 9 | import os 10 | import sys 11 | import json 12 | import cv2 13 | from PIL import ImageGrab 14 | 15 | #原文:https://blog.csdn.net/weixin_37557902/article/details/82740593 16 | usageMsg = u"使用方法:\n1.运行CMD命令:cmd xxx (xxx为命令)\n" \ 17 | u"例如关机命令:\ncmd shutdown -s -t 0 \n" \ 18 | u"2.获取摄像头并拍照:cap\n" \ 19 | u"2.获取屏幕截屏:pc\n" \ 20 | 21 | KEY = '04f44290d4cf462aae8ac563ea7aac16' 22 | 23 | def get_response(msg): 24 | apiUrl = 'http://www.tuling123.com/openapi/api' 25 | data = { 26 | 'key' : KEY, 27 | 'info' : msg, 28 | 'userid' : 'wechat-robot', 29 | } 30 | try: 31 | r = requests.post(apiUrl, data=data).json() 32 | return r.get('text') 33 | except: 34 | return 35 | 36 | @itchat.msg_register('Text') 37 | def handler_receive_msg(msg): # 处理收到的消息 38 | message = msg['Text'] 39 | toName = msg['ToUserName'] 40 | #owner = msg['User']['PYQuanPin'] 41 | # 临时保存截屏图片地址 42 | #path = 'C:\Users\wqw\Desktop\fig\temp.jpg' 43 | path = 'tmp.jpg' 44 | reply = json.dumps(msg, ensure_ascii=False) 45 | reply = '你发了:%s'%message 46 | #{"MsgId": "9212371634710588729", "FromUserName": "@ad238825281702d637159eab5f24f89e", "ToUserName": "@ad238825281702d637159eab5f24f89e", "MsgType": 1, "Content": "你", "Status": 3, "ImgStatus": 1, "CreateTime": 1541315145, "VoiceLength": 0, "PlayLength": 0, "FileName": "", "FileSize": "", "MediaId": "", "Url": "", "AppMsgType": 0, "StatusNotifyCode": 0, "StatusNotifyUserName": "", "RecommendInfo": {"UserName": "", "NickName": "", "QQNum": 0, "Province": "", "City": "", "Content": "", "Signature": "", "Alias": "", "Scene": 0, "VerifyFlag": 0, "AttrStatus": 0, "Sex": 0, "Ticket": "", "OpCode": 0}, "ForwardFlag": 0, "AppInfo": {"AppID": "", "Type": 0}, "HasProductId": 0, "Ticket": "", "ImgHeight": 0, "ImgWidth": 0, "SubMsgType": 0, "NewMsgId": 9212371634710588729, "OriContent": "", "EncryFileName": "", "User": {"MemberList": [], "UserName": "@ad238825281702d637159eab5f24f89e", "City": "海淀", "DisplayName": "", "PYQuanPin": "wangqiwen", "RemarkPYInitial": "", "Province": "北京", "KeyWord": "wqw", "RemarkName": "", "PYInitial": "WQW", "EncryChatRoomId": "", "Alias": "", "Signature": "自律更自由", "NickName": "王奇文", "RemarkPYQuanPin": "", "HeadImgUrl": "/cgi-bin/mmwebwx-bin/webwxgeticon?seq=661826231&username=@ad238825281702d637159eab5f24f89e&skey=@crypt_15c532e6_ba943df756f74fb80686ff7d62c8c677", "UniFriend": 0, "Sex": 1, "AppAccountFlag": 0, "VerifyFlag": 0, "ChatRoomId": 0, "HideInputBarFlag": 0, "AttrStatus": 33656871, "SnsFlag": 17, "MemberCount": 0, "OwnerUin": 0, "ContactFlag": 3, "Uin": 965715160, "StarFriend": 0, "Statues": 0, "WebWxPluginSwitch": 0, "HeadImgFlag": 1, "IsOwner": 0}, "Type": "Text", "Text": "你"} 47 | #if toName in ('@ad238825281702d637159eab5f24f89e', "filehelper" ): 48 | if toName == "filehelper": 49 | if message == "cap": # 拍照 50 | # 要使用摄像头,需要使用cv2.VideoCapture(0)创建VideoCapture对象, 51 | # 参数:0指的是摄像头的编号。如果你电脑上有两个摄像头的话,访问第2个摄像头就可以传入1 52 | cap = cv2.VideoCapture(0) 53 | ret, img = cap.read() # 获取一帧 54 | cv2.imwrite("temp.jpg", img) 55 | itchat.send('@img@%s' % u'temp.jpg', toName) 56 | cap.release() # 释放资源 57 | if message[0:3] == "cmd": # 处理cmd命令 58 | os.system(message.strip(message[0:4])) 59 | if message == "pc": # 截图 60 | im = ImageGrab.grab() # 实现截屏功能 61 | im.save(path, 'JPEG') # 设置保存路径和图片格式 62 | itchat.send_image(path, toName) 63 | # 微信表情符对照表:https://www.cnblogs.com/xuange306/p/7098236.html 64 | emoji = [')', 'B', 'X', 'Z', 'Q', 'T', 'L', 'g', '|', '<','>', '~', '’(', '$', '!','O', 'P', '+','*'] 65 | 66 | robots = ['/::%s'%(i) for i in emoji] 67 | reply = get_response(msg['Text'])+random.choice(robots) 68 | res = '收到%s的消息[%s], 回复:[%s]'%(toName, message, reply) 69 | print(sys.stderr, res) 70 | return reply or defaultReply 71 | 72 | # @itchat.msg_register(itchat.content.TEXT) 73 | # def tuling_reply(msg): 74 | # defaultReply = 'I received: ' + msg['Text'] 75 | # #robot = ['——By机器人小杨','——By机器人白杨','——By反正不是本人'] 76 | # robots = ['-^-','^-^','~v~'] 77 | # reply = get_response(msg['Text'])+random.choice(robots) 78 | # return reply or defaultReply 79 | 80 | # 处理群聊消息 81 | """ 82 | @itchat.msg_register(itchat.content.TEXT, isGroupChat=True) 83 | def text_reply(msg): 84 | if msg['isAt']: 85 | itchat.send(u'@%s\u2005I received: %s' % (msg['ActualNickName'], msg)) 86 | """ 87 | # 自动回复 88 | # 封装好的装饰器,当接收到的消息是Text,即文字消息 89 | """ 90 | @itchat.msg_register('Text') 91 | def text_reply(msg): 92 | # 当消息不是由自己发出的时候 93 | if not msg['FromUserName'] == myUserName: 94 | # 发送一条提示给文件助手 95 | itchat.send_msg(u"[%s]收到好友@%s 的信息:%s\n" % 96 | (time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(msg['CreateTime'])), 97 | msg['User']['NickName'], 98 | msg['Text']), 'filehelper') 99 | # 回复给好友 100 | return u'[自动回复]您好,我现在有事不在,一会再和您联系。\n已经收到您的的信息:%s\n' % (msg['Text']) 101 | """ 102 | 103 | 104 | 105 | if __name__ == '__main__': 106 | itchat.auto_login() 107 | # 获取自己的UserName 108 | #myUserName = itchat.get_friends(update=True)[0]["UserName"] 109 | owner = "@ad238825281702d637159eab5f24f89e"#filehelper 110 | itchat.send(usageMsg, owner)#,filehelper 111 | itchat.run() -------------------------------------------------------------------------------- /demo/itchat/itchat.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wqw547243068/wangqiwen/07b64ae47d91581e1c339f40bc765fd7815b47ff/demo/itchat/itchat.pkl -------------------------------------------------------------------------------- /demo/itchat/wechat.xls: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wqw547243068/wangqiwen/07b64ae47d91581e1c339f40bc765fd7815b47ff/demo/itchat/wechat.xls -------------------------------------------------------------------------------- /demo/itchat/wechat_robot/auto_replay.py: -------------------------------------------------------------------------------- 1 | # -*- coding:utf-8 -*- 2 | """ 3 | 微信机器人,自动回复 4 | """ 5 | import requests 6 | import random 7 | import sys 8 | import json 9 | import itchat, time, re 10 | from itchat.content import * 11 | 12 | 13 | @itchat.msg_register([TEXT]) 14 | def text_reply(msg, category = 2): 15 | """ 文本消息回复 """ 16 | message = msg['Text'] 17 | toName = msg['ToUserName'] 18 | #owner = msg['User']['PYQuanPin'] 19 | #reply = json.dumps(msg, ensure_ascii=False) 20 | # 微信表情符对照表:https://www.cnblogs.com/xuange306/p/7098236.html 21 | emoji_tag = [')', 'B', 'X', 'Z', 'Q', 'T', 'L', 'g', '|', '<','>', '~', ",(", '$', '!','O', 'P', '+', '*'] 22 | emoji_list = ["/::%s"%(i) for i in emoji_tag] 23 | reply = '不知道说啥好了' # 安全回答 24 | if category == 1: 25 | # (1)自动拜年回复 26 | match = re.search(u'年', msg['Text']).span() 27 | if match: 28 | reply = '谢谢!新春快乐,鸡年大吉,身体健康,万事如意!' 29 | elif category == 2: 30 | # (2)启动图灵机器人 31 | try: 32 | #reply_api = tuling(msg['Text']) 33 | reply_api = get_response(msg['Text']) 34 | except Exception: 35 | print(sys.stderr, '接口故障,请跟进,返回默认答复') 36 | reply_api = reply 37 | # 拼接微信表情符(随机选取) 38 | reply = '%s %s'%(reply_api, random.choice(emoji_list)) 39 | else: 40 | print('category取值异常') 41 | # 回复 42 | #itchat.send(reply, msg['FromUserName']) 43 | res = '收到%s的消息[%s], 回复:[%s]'%(toName, message, reply) 44 | print(sys.stderr, res) 45 | return reply 46 | 47 | @itchat.msg_register([PICTURE, RECORDING, VIDEO, SHARING]) 48 | def other_reply(msg): 49 | itchat.send((u'新春快乐,鸡年大吉,身体健康,万事如意!'), msg['FromUserName']) 50 | 51 | 52 | # 注册文本消息,绑定到text_reply处理函数 53 | # text_reply msg_files可以处理好友之间的聊天回复 54 | @itchat.msg_register([MAP,CARD,NOTE,SHARING]) 55 | def text_reply(msg): 56 | itchat.send('%s' % tuling(msg['Text']),msg['FromUserName']) 57 | 58 | @itchat.msg_register([PICTURE, RECORDING, ATTACHMENT, VIDEO]) 59 | def download_files(msg): 60 | msg['Text'](msg['FileName']) 61 | return '@%s@%s' % ({'Picture': 'img', 'Video': 'vid'}.get(msg['Type'], 'fil'), msg['FileName']) 62 | 63 | # # 对于群聊信息,定义获取想要针对某个群进行机器人回复的群ID函数 64 | # def group_id(name): 65 | # df = itchat.search_chatrooms(name=name) 66 | # return df[0]['UserName'] 67 | 68 | # # 现在微信加了好多群,并不想对所有的群都进行设置微信机器人,只针对想要设置的群进行微信机器人,可进行如下设置 69 | # @itchat.msg_register(TEXT, isGroupChat=True) 70 | # def group_text_reply(msg): 71 | # # 当然如果只想针对@你的人才回复,可以设置if msg['isAt']: 72 | # item = group_id('未来计划群') # 根据自己的需求设置 73 | # if msg['ToUserName'] == item: 74 | # itchat.send(u'%s' % tuling(msg['Text']), item) 75 | 76 | # 调用图灵机器人的api,采用爬虫的原理,根据聊天消息返回回复内容 77 | def tuling(info): 78 | appkey = "e5ccc9c7c8834ec3b08940e290ff1559" 79 | url = "http://www.tuling123.com/openapi/api?key=%s&info=%s"%(appkey,info) 80 | req = requests.get(url) 81 | content = req.text 82 | data = json.loads(content) 83 | answer = data['text'] 84 | return answer 85 | 86 | def get_response(msg): 87 | """ 机器人API """ 88 | result = '-' 89 | source = '图灵' 90 | # 图灵机器人>青云客 91 | api_turing = 'http://www.tuling123.com/openapi/api' 92 | appkey = "e5ccc9c7c8834ec3b08940e290ff1559" 93 | api_qingyunke = "http://api.qingyunke.com/api.php" 94 | data = { 95 | 'key' : appkey, 96 | 'info' : msg, 97 | 'userid' : 'wechat-robot', 98 | } 99 | try: 100 | result = requests.post(api_turing, data=data).json().get('text') 101 | except: 102 | #青云客机器人 103 | resp = requests.get(api_qingyunke, {'key': 'free', 'appid': 0, 'msg': msg}) 104 | resp.encoding = 'utf8' 105 | result = resp.json()['content'] 106 | source = '青云客' 107 | print('{}\t{:<40}\t{:<40}'.format(source, msg, result)) 108 | return result 109 | 110 | 111 | 112 | 113 | if __name__ == '__main__': 114 | # 主程序 115 | itchat.auto_login(hotReload=True) # 图片二维码 116 | #itchat.auto_login(enableCmdQR=0.5,hotReload=True) # 终端二维码 117 | itchat.run() -------------------------------------------------------------------------------- /demo/itchat/wechat_robot/auto_tuling.py: -------------------------------------------------------------------------------- 1 | ##################### 完整代码############################## 2 | # 加载库 3 | from itchat.content import * 4 | import requests 5 | import json 6 | import itchat 7 | 8 | 9 | # 调用图灵机器人的api,采用爬虫的原理,根据聊天消息返回回复内容 10 | def tuling(info): 11 | appkey = "e5ccc9c7c8834ec3b08940e290ff1559" 12 | url = "http://www.tuling123.com/openapi/api?key=%s&info=%s"%(appkey,info) 13 | req = requests.get(url) 14 | content = req.text 15 | data = json.loads(content) 16 | answer = data['text'] 17 | return answer 18 | 19 | # 对于群聊信息,定义获取想要针对某个群进行机器人回复的群ID函数 20 | def group_id(name): 21 | df = itchat.search_chatrooms(name=name) 22 | return df[0]['UserName'] 23 | 24 | # 注册文本消息,绑定到text_reply处理函数 25 | # text_reply msg_files可以处理好友之间的聊天回复 26 | @itchat.msg_register([TEXT,MAP,CARD,NOTE,SHARING]) 27 | def text_reply(msg): 28 | itchat.send('%s' % tuling(msg['Text']),msg['FromUserName']) 29 | 30 | @itchat.msg_register([PICTURE, RECORDING, ATTACHMENT, VIDEO]) 31 | def download_files(msg): 32 | msg['Text'](msg['FileName']) 33 | return '@%s@%s' % ({'Picture': 'img', 'Video': 'vid'}.get(msg['Type'], 'fil'), msg['FileName']) 34 | 35 | # 现在微信加了好多群,并不想对所有的群都进行设置微信机器人,只针对想要设置的群进行微信机器人,可进行如下设置 36 | @itchat.msg_register(TEXT, isGroupChat=True) 37 | def group_text_reply(msg): 38 | # 当然如果只想针对@你的人才回复,可以设置if msg['isAt']: 39 | item = group_id(u'想要设置的群的名称') # 根据自己的需求设置 40 | if msg['ToUserName'] == item: 41 | itchat.send(u'%s' % tuling(msg['Text']), item) 42 | 43 | if __name__ == '__main__': 44 | appkey = "e5ccc9c7c8834ec3b08940e290ff1559" 45 | info = '你好!' 46 | cnt = 1 47 | while True: 48 | info = input("[第%s轮]\t"%(cnt)) 49 | if info.find("exit") != -1 or info.find("quit") != -1 or info.find("退出") != -1: 50 | print("退出...") 51 | break 52 | url = "http://www.tuling123.com/openapi/api?key=%s&info=%s"%(appkey,info) 53 | req = requests.get(url) 54 | content = req.text 55 | data = json.loads(content) 56 | answer = data['text'] 57 | print("答 复: \t%s"%(answer)) 58 | cnt += 1 59 | print('='*30) 60 | print(tuling(u'你好')) 61 | #itchat.auto_login(hotReload = True) 62 | #itchat.run() 63 | -------------------------------------------------------------------------------- /demo/itchat/wechat_robot/chatbot.py: -------------------------------------------------------------------------------- 1 | # coding:utf8 2 | """ 3 | 图灵机器人与青云客机器人聊天对战 4 | 使用方法:终端执行此脚本,python chatbot.py, 输入一个词启动会话即可 5 | [2018-11-4]python初学者好玩案例:https://blog.csdn.net/qq_18495537/article/details/79278710 6 | """ 7 | from time import sleep 8 | import requests 9 | 10 | s = input("请主人输入话题:(随便什么词)") 11 | same_max = 10#中止条件,恢复语句中最多多少次相同 12 | same_count = 0 13 | last_resp = '-' 14 | count = 0 15 | print('{}\t{:<40}\t{:<40}\n{}'.format('轮数', '图灵(问)', '青云客(答)', '-'*80)) 16 | while True: 17 | count += 1 18 | #图灵机器人 19 | resp = requests.post("http://www.tuling123.com/openapi/api", 20 | data={"key": "e5ccc9c7c8834ec3b08940e290ff1559", "info": s, }) 21 | resp = resp.json() 22 | #print('第{}轮\t图灵:\t{}'.format(count, resp['text'])) 23 | if resp == last_resp: 24 | same_count += 1 25 | if same_count > same_max: 26 | print('这两货把天儿聊死了。。。哈哈哈') 27 | break 28 | #青云客机器人 29 | s = resp['text'] 30 | resp = requests.get("http://api.qingyunke.com/api.php", {'key': 'free', 'appid': 0, 'msg': s}) 31 | resp.encoding = 'utf8' 32 | resp = resp.json() 33 | sleep(1) 34 | #print('第{}轮\t青云客:\t{}'.format(count, resp['content'])) 35 | print('{}\t{:<40}\t{:<40}'.format(count, s, resp['content'])) -------------------------------------------------------------------------------- /demo/itchat/wechat_robot/chatbot_compitition.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wqw547243068/wangqiwen/07b64ae47d91581e1c339f40bc765fd7815b47ff/demo/itchat/wechat_robot/chatbot_compitition.jpg -------------------------------------------------------------------------------- /demo/itchat/wechat_robot/wechat_control.py: -------------------------------------------------------------------------------- 1 | # -*- coding=utf-8 -*- 2 | """ 3 | 微信助手,可以通过微信远程控制电脑,截屏、摄像头拍照 4 | """ 5 | 6 | import requests 7 | import itchat 8 | import random 9 | # import sys 10 | # reload(sys) 11 | # sys.setdefaultencoding('utf-8') 12 | 13 | import os 14 | import sys 15 | import json 16 | import cv2 17 | from PIL import ImageGrab 18 | 19 | #原文:https://blog.csdn.net/weixin_37557902/article/details/82740593 20 | usageMsg = u"使用方法:\n1.运行CMD命令:cmd xxx (xxx为命令)\n" \ 21 | u"例如关机命令:\ncmd shutdown -s -t 0 \n" \ 22 | u"2.获取摄像头并拍照:cap\n" \ 23 | u"2.获取屏幕截屏:pc\n" \ 24 | 25 | KEY = '04f44290d4cf462aae8ac563ea7aac16' 26 | 27 | def get_response(msg): 28 | apiUrl = 'http://www.tuling123.com/openapi/api' 29 | data = { 30 | 'key' : KEY, 31 | 'info' : msg, 32 | 'userid' : 'wechat-robot', 33 | } 34 | try: 35 | r = requests.post(apiUrl, data=data).json() 36 | return r.get('text') 37 | except: 38 | return 39 | 40 | @itchat.msg_register('Text') 41 | def handler_receive_msg(msg): # 处理收到的消息 42 | message = msg['Text'] 43 | toName = msg['ToUserName'] 44 | #owner = msg['User']['PYQuanPin'] 45 | # 临时保存截屏图片地址 46 | #path = 'C:\Users\wqw\Desktop\fig\temp.jpg' 47 | path = 'tmp.jpg' 48 | reply = json.dumps(msg, ensure_ascii=False) 49 | reply = '你发了:%s'%message 50 | #{"MsgId": "9212371634710588729", "FromUserName": "@ad238825281702d637159eab5f24f89e", "ToUserName": "@ad238825281702d637159eab5f24f89e", "MsgType": 1, "Content": "你", "Status": 3, "ImgStatus": 1, "CreateTime": 1541315145, "VoiceLength": 0, "PlayLength": 0, "FileName": "", "FileSize": "", "MediaId": "", "Url": "", "AppMsgType": 0, "StatusNotifyCode": 0, "StatusNotifyUserName": "", "RecommendInfo": {"UserName": "", "NickName": "", "QQNum": 0, "Province": "", "City": "", "Content": "", "Signature": "", "Alias": "", "Scene": 0, "VerifyFlag": 0, "AttrStatus": 0, "Sex": 0, "Ticket": "", "OpCode": 0}, "ForwardFlag": 0, "AppInfo": {"AppID": "", "Type": 0}, "HasProductId": 0, "Ticket": "", "ImgHeight": 0, "ImgWidth": 0, "SubMsgType": 0, "NewMsgId": 9212371634710588729, "OriContent": "", "EncryFileName": "", "User": {"MemberList": [], "UserName": "@ad238825281702d637159eab5f24f89e", "City": "海淀", "DisplayName": "", "PYQuanPin": "wangqiwen", "RemarkPYInitial": "", "Province": "北京", "KeyWord": "wqw", "RemarkName": "", "PYInitial": "WQW", "EncryChatRoomId": "", "Alias": "", "Signature": "自律更自由", "NickName": "王奇文", "RemarkPYQuanPin": "", "HeadImgUrl": "/cgi-bin/mmwebwx-bin/webwxgeticon?seq=661826231&username=@ad238825281702d637159eab5f24f89e&skey=@crypt_15c532e6_ba943df756f74fb80686ff7d62c8c677", "UniFriend": 0, "Sex": 1, "AppAccountFlag": 0, "VerifyFlag": 0, "ChatRoomId": 0, "HideInputBarFlag": 0, "AttrStatus": 33656871, "SnsFlag": 17, "MemberCount": 0, "OwnerUin": 0, "ContactFlag": 3, "Uin": 965715160, "StarFriend": 0, "Statues": 0, "WebWxPluginSwitch": 0, "HeadImgFlag": 1, "IsOwner": 0}, "Type": "Text", "Text": "你"} 51 | #if toName in ('@ad238825281702d637159eab5f24f89e', "filehelper" ): 52 | if toName == "filehelper": 53 | if message == "cap": # 拍照 54 | # 要使用摄像头,需要使用cv2.VideoCapture(0)创建VideoCapture对象, 55 | # 参数:0指的是摄像头的编号。如果你电脑上有两个摄像头的话,访问第2个摄像头就可以传入1 56 | cap = cv2.VideoCapture(0) 57 | ret, img = cap.read() # 获取一帧 58 | cv2.imwrite("temp.jpg", img) 59 | itchat.send('@img@%s' % u'temp.jpg', toName) 60 | cap.release() # 释放资源 61 | if message[0:3] == "cmd": # 处理cmd命令 62 | os.system(message.strip(message[0:4])) 63 | if message == "pc": # 截图 64 | im = ImageGrab.grab() # 实现截屏功能 65 | im.save(path, 'JPEG') # 设置保存路径和图片格式 66 | itchat.send_image(path, toName) 67 | # 微信表情符对照表:https://www.cnblogs.com/xuange306/p/7098236.html 68 | emoji = [')', 'B', 'X', 'Z', 'Q', 'T', 'L', 'g', '|', '<','>', '~', '’(', '$', '!','O', 'P', '+','*'] 69 | robots = ['/::%s'%(i) for i in emoji] 70 | reply = get_response(msg['Text'])+random.choice(robots) 71 | res = '收到%s的消息[%s], 回复:[%s]'%(toName, message, reply) 72 | print(sys.stderr, res) 73 | return reply or defaultReply 74 | 75 | # @itchat.msg_register(itchat.content.TEXT) 76 | # def tuling_reply(msg): 77 | # defaultReply = 'I received: ' + msg['Text'] 78 | # #robot = ['——By机器人小杨','——By机器人白杨','——By反正不是本人'] 79 | # robots = ['-^-','^-^','~v~'] 80 | # reply = get_response(msg['Text'])+random.choice(robots) 81 | # return reply or defaultReply 82 | 83 | # 处理群聊消息 84 | """ 85 | @itchat.msg_register(itchat.content.TEXT, isGroupChat=True) 86 | def text_reply(msg): 87 | if msg['isAt']: 88 | itchat.send(u'@%s\u2005I received: %s' % (msg['ActualNickName'], msg)) 89 | """ 90 | # 自动回复 91 | # 封装好的装饰器,当接收到的消息是Text,即文字消息 92 | """ 93 | @itchat.msg_register('Text') 94 | def text_reply(msg): 95 | # 当消息不是由自己发出的时候 96 | if not msg['FromUserName'] == myUserName: 97 | # 发送一条提示给文件助手 98 | itchat.send_msg(u"[%s]收到好友@%s 的信息:%s\n" % 99 | (time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(msg['CreateTime'])), 100 | msg['User']['NickName'], 101 | msg['Text']), 'filehelper') 102 | # 回复给好友 103 | return u'[自动回复]您好,我现在有事不在,一会再和您联系。\n已经收到您的的信息:%s\n' % (msg['Text']) 104 | """ 105 | 106 | 107 | 108 | if __name__ == '__main__': 109 | itchat.auto_login() 110 | # 获取自己的UserName 111 | #myUserName = itchat.get_friends(update=True)[0]["UserName"] 112 | owner = "@ad238825281702d637159eab5f24f89e"#filehelper 113 | itchat.send(usageMsg, owner)#,filehelper 114 | itchat.run() -------------------------------------------------------------------------------- /demo/skin_detect/data/0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wqw547243068/wangqiwen/07b64ae47d91581e1c339f40bc765fd7815b47ff/demo/skin_detect/data/0.jpg -------------------------------------------------------------------------------- /demo/skin_detect/data/1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wqw547243068/wangqiwen/07b64ae47d91581e1c339f40bc765fd7815b47ff/demo/skin_detect/data/1.jpg -------------------------------------------------------------------------------- /demo/skin_detect/output/0_Nude.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wqw547243068/wangqiwen/07b64ae47d91581e1c339f40bc765fd7815b47ff/demo/skin_detect/output/0_Nude.jpg -------------------------------------------------------------------------------- /demo/skin_detect/output/1_Normal.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wqw547243068/wangqiwen/07b64ae47d91581e1c339f40bc765fd7815b47ff/demo/skin_detect/output/1_Normal.jpg -------------------------------------------------------------------------------- /demo/skin_detect/readme.ini: -------------------------------------------------------------------------------- 1 | #Python 3 色情图片识别,http://blog.csdn.net/mbugatti/article/details/53580575 2 | wget http://labfile.oss.aliyuncs.com/courses/589/nude.py 3 | -------------------------------------------------------------------------------- /other/figure/mmexport1563449034348.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wqw547243068/wangqiwen/07b64ae47d91581e1c339f40bc765fd7815b47ff/other/figure/mmexport1563449034348.jpg -------------------------------------------------------------------------------- /other/figure/readme.md: -------------------------------------------------------------------------------- 1 | # 说明 2 | - 汇总图像资源 3 | -------------------------------------------------------------------------------- /other/figure/wqw.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wqw547243068/wangqiwen/07b64ae47d91581e1c339f40bc765fd7815b47ff/other/figure/wqw.png -------------------------------------------------------------------------------- /python/cws.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | # Zhang, Kaixu kareyzhang.gmail.com 3 | import argparse 4 | import sys 5 | import json 6 | import time 7 | 8 | class Weights(dict): # 管理平均感知器的权重 9 | def __init__(self): 10 | self._step=0 11 | self._acc=dict() 12 | def update_weights(self,key,delta): # 更新权重 13 | if key not in self : self[key]=0 14 | self[key]+=delta 15 | if key not in self._acc : self._acc[key]=0 16 | self._acc[key]+=self._step*delta 17 | def average(self): # 平均 18 | for k,v in self._acc.items(): 19 | self[k]=self[k]-self._acc[k]/self._step 20 | def save(self,filename): 21 | json.dump({k:v for k,v in self.items() if v!=0.0}, 22 | open(filename,'w'), 23 | ensure_ascii=False,indent=1) 24 | def load(self,filename): 25 | self.update(json.load(open(filename))) 26 | 27 | class CWS : 28 | def __init__(self): 29 | self.weights=Weights() 30 | def gen_features(self,x): # 枚举得到每个字的特征向量 31 | for i in range(len(x)): 32 | left2=x[i-2] if i-2 >=0 else '#' 33 | left1=x[i-1] if i-1 >=0 else '#' 34 | mid=x[i] 35 | right1=x[i+1] if i+1.*? 16 | .*? 17 | (.*?).*? # title 主标题 18 | (.*?).*? # sub title 子标题 19 | .*? 20 | .*? 21 |
.*? 22 | .*? 23 | (.*?).*? # 关注人数 24 |
.*? 25 | .*? 26 | (.*?).*? # 看过人数 27 | .*? 28 | .*? 29 | .*? 30 | .*? 31 | .*? 32 | .*?.*?(.*?).*? # 总价 34 | (.*?)元/平米 # 均价,元/平方米 35 | 首付(.*?)税费(.*?)万\(仅供参考\)\s+.*? #首付,税费 36 | 37 | 38 | (.*?) #户型 39 | (.*?) #楼层 40 | 41 | 42 | (.*?) #朝向 43 | (.*?) #装修 44 | 45 | 46 | (.*?) #面积 47 | (.*?) #建设时间 48 | 49 | 50 | 51 | 小区名称(.*?)地图 # 小区链接,小区名 52 | 所在区域(.*?).*?(.*?)(.*?).*? # 小区所在区域:昌平,北七家,五环到六环 53 | 看房时间(.*?) # 看房时间 54 | 链家编号(.*?).*? # 看房时间 55 | .*?.*? 56 | ''',re.X|re.S) 57 | pattern_tag = re.compile(r'''(.*?)''',re.X|re.S) 58 | pattern_para = re.compile(r'''(.*?)

''',re.X|re.S) 59 | # 剔除特殊符号 60 | #p_single = re.compile(r'') # 剔除图片信息 61 | #p_pair = re.compile(r'<(.*?)\s?.*?>(.*?)') # 剔除外链信息 62 | p_html = re.compile(r'(<[^>]+>)|( )',re.S) 63 | 64 | # 抓取资讯首页 65 | # http://jiqizhixin.com/edge/p/1 66 | #["燕城苑南北两居,业主诚心出售,看房方便。", "南北通透两居,视野好,集中供暖!", "35", "2", "345", "40464", "121万 ", "13.8", "2室2厅", "高楼层/共6层", "南 北", "平层/简装", "85.26平米", "1995年建/板楼", "/xiaoqu/1111027381547/", "燕城苑北区", "/ershoufang/changping/", "昌平", "/ershoufang/beiqijia/", "北七家", " 五至六环", "有租户需要预约", "101100960378"] 67 | output_format = ['房源','备注','关注人数','看过人数','总价','均价','首付','税费','户型','楼层','朝向','装修','面积','年代','小区链接','小区名称','区链接','区名','镇链接','镇名','街道','看房','编号'] 68 | print('\t'.join(output_format)) 69 | page_list = ['101100791393','101100960378'] 70 | #for page in page_list: 71 | for line in file('house_id.txt'): 72 | page = line.strip().strip('.html') 73 | #curl_path = 'curl http://bj.lianjia.com/ershoufang/101100960378.html' 74 | curl_path = 'curl http://bj.lianjia.com/ershoufang/%s.html'%(page) 75 | content = subprocess.check_output(curl_path,shell=True); #如果命令执行的返回值不为0,则会抛出CalledProcessError的错误 76 | #print(content) 77 | result = re.findall(pattern_article,content) 78 | output_dict = dict(zip(output_format,result[0])) 79 | #output = re.findall(pattern_article,content.decode('utf8')) 80 | print('\t'.join(result[0])) 81 | #print(json.dumps(result[0],ensure_ascii=False)) 82 | #print(json.dumps(output_dict,ensure_ascii=False)) 83 | 84 | 85 | -------------------------------------------------------------------------------- /python/mysql_test.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python2.7 2 | # coding=utf-8 3 | #参考http://www.cnblogs.com/fnng/p/3565912.html 4 | ''' 5 | #mysql初始化-shell 6 | mysql=/usr/local/mysql/bin/mysql 7 | $mysql -uroot -pwqw < init.sql 8 | ------ 9 | $mysql -uroot -p123456 <