1.開啟pycharm,在settings中安裝itchat,過程需要聯網
2.新增成功後可以匯入itchat模組
"""
# _*_coding:utf-8_*_
date:1/23/19
author:westos-dz
""""""
"""import itchat
import time
import random
itchat.auto_login()
# while true:
#1.給手機助手傳送訊息
# itchat.send('hello',tousername='filehelper')
# time.sleep(random.randint(1,3))
#2.統計好友列表
# print(friends)
# info = {}
## #統計好友列表中的各性別人數
# for friend in friends[1:]:
# if friend['***'] ==1:
# info['male'] = info.get('male',0) +1
# elif friend['***'] == 2:
# info['female'] = info.get('female',0) +1
# else:
# info['other'] = info.get('other',0) +1
# print(info)
##########3################
"""需求:給檔案助手傳送訊息,執行傳送的內容
1.如果執行成功,顯示執行結果
2.如果執行失敗,顯示執行失敗
"""import os
import itchat
@itchat.msg_register(itchat.content.text)
def text_reply(msg):
if msg['tousername'] == 'filehelper':
#獲取要執行命令的內容
command = msg['content']
print(command)
#讓電腦執行命令**
#如果執行成功,返回值為0
if os.system(command) == 0:
res = os.popen(command).read()
result = '【返回值】 - 命令執行成功,執行結果:\n' +res
itchat.send(result,'filehelper')
#命令執行失敗,請重新輸入命令
else:
result = '【返回值】 - 命令%s執行失敗,請重試' %command
itchat.send(result,'filehelper')
itchat.auto_login()
itchat.run()
第三方模組
參考 第三方模組 requestsimport requests 對於帶引數的url,傳入乙個dict作為params引數 params 要傳入http header時,我們傳入乙個dict作為headers引數 請求中傳入cookie,只需準備乙個dict傳入cookies引數 my cookie...
python模組之第三方模組
什麼是第三方模組 1 命令列借助於pip工具 pip3 install 模組名 不知道版本預設是最新版 pip3 install 模組名 版本號 pip3 install 模組名 i 倉庫位址 臨時切換 注 pip所在的路徑需要新增環境變數 命令列形式永久修改需要修改python直譯器原始檔 例 p...
Python第三方模組tesserocr安裝
20190125補充,換了個新電腦win10,安裝都很正常,但是在匯入模組的時候出錯,提示如下 traceback most recent call last file line 1,in import tesserocr file d program files python lib site p...