sys,itchat及第三方模块

sys模块
import os
import sys

print(sys.argv)##命令模式下获取路径
print(sys.argv[0])##获取脚本名

print(sys.version)##获取python版本,类型为字符串
if sys.version[0] == ‘2’:
print(‘running in python2’)
else:
print(‘running in python3’)

print(sys.path)##初始化python的环境变量

print(sys.platfrom) ##打印所属平台
if sys.platform == ‘linux’:
os.system(‘ifconfig’)
else:
os.system(‘ipconfig’)

第三方模块
##生成二维码(直接跳转至百度)
对于该类信息,一定要注意自身信息安全
import qrcode
img = qrcode.make(‘http://www.baidu.com’)
img .save(‘hello.png’)

##生成二维码,扫描后会一直收到信息,需要itchat模块支持
import time
import random
import itchat
itchat.auto_login()
while True:
itchat.send(‘hello westos’,toUserName=‘filehelper’)
time.sleep(random.randint(1,3))

itchat
import os
import itchat

@itchat.msg_registeer(itchat.content.Text,isFriendChat=True)
def text_reply(msg):
if msg[‘ToUserName’] == ‘filehelper’:
command = msg[‘content’]
if os.system(command) == 0:
res = os.popen(command).

itchat.auto_login()
itchat.run()

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值