随笔分类 - uiautomator2
python项目目录添加到python环境变量中
摘要:vim ~/.bash_profile 在.bash_profile中添加一下两行 PYTHONPATH=/mnt/udisk/project/myproject/wanwenyc export PYTHONPATH 修改完成执行以下命令生效 #source ~/.bash_profile
阅读全文
python 安装虚拟环境
摘要:1. pip install virtualenv 2.pip install virtualenvwrapper-win 注: linux下运行pip install virtualenvwrapper
阅读全文
安装xadmin2.0命令
摘要:pip3 install https://codeload.github.com/sshwsfc/xadmin/zip/django2 -i https://pypi.douban.com/simple/或者 pip install https://codeload.github.com/sshws
阅读全文
django xadmin 根据是否管理员 设置只读字段
摘要:#指导教程class GuideHelpXadmin(object): all_zi_duan = ["id", "add_time", "update_time"] list_display = ['guide_project', 'go_to'] # 定义显示的字段 list_filter =
阅读全文
django model关联保存
摘要:class GuideHelp(models.Model): guide_project = models.CharField(max_length=100, default="", null=True, blank=True, verbose_name=u"指导文件名称") guide_file
阅读全文
python 将字符串作为脚本运行
摘要:def exec_code(): LOC = """ def factorial(num): fact=1 for i in range(1,num+1): fact = fact*i return fact print(factorial(5)) """ exec(LOC) exec_code()
阅读全文
django 视图中异步执行python脚本
摘要:python脚本:autoStaticRDMTask.py # import os, django os.environ.setdefault("DJANGO_SETTINGS_MODULE", "wanwenyc.settings") django.setup() # # 独运行某一个py文件时会
阅读全文
python 异步执行python脚本
摘要:async_call.py from threading import Thread def async_call(fn): def wrapper(*args, **kwargs): Thread(target=fn, args=args, kwargs=kwargs).start() retur
阅读全文
django 筛选不等于的内容
摘要:myapps = App.objects.filter(name != ''))这种写法是不对的,正确写法是: from django.db.models import Q myapps = App.objects.filter(~Q(name= ''))
阅读全文
python 字典和json树形输出
摘要:import json a = {}print(json.dumps(a, indent=1))#indent=1代表字节点比父节点前多几个空格
阅读全文
cannot import name 'UnidentifiedImageError'
摘要:更换pillow的版本pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pillow==4.0.0
阅读全文
pycharm 解决 “ invalid authentication data”
摘要:0.先将pycharm中Settings中的“Version Control” 中无效的Git删除,并且点击OK,确定删除(如果没有,则不需要删除); 1.登录到 “https://github.com/settings/tokens”,将原有的token清空,关闭pycharm,重启pycharm
阅读全文
python解决编码时,单鞋杠变为双斜杠问题
摘要:a = "1D0\x00" b = a.encode("gbk").decode("unicode_escape") #将字符串先编码后解码,解决单斜杠,变为双斜杠问题
阅读全文
adb 无限连接手机
摘要:1.usb先连接手机与电脑; 2.adb devices :检测到手机; 3.adb tcpip 5555 :打开5555端口 4.拔掉数据线 5.adb connect 192.168.1.100:5555 其中192.168.1.100为你手机的实际IP地址 6.adb devices :查看是
阅读全文
python uiautomator2 安装
摘要:1.安装: pip install -i https://pypi.tuna.tsinghua.edu.cn/simple uiautomator2 pip install -i https://pypi.tuna.tsinghua.edu.cn/simple weditor 2.使用: pytho
阅读全文