按以往python2的习惯编码输出报错 #-*- coding:utf-8 -*- ''' Created on 2018年7月21日 @author: lenovo ''' import os import sys import subprocess from uiautomator import device as d cmd = r'adb install F:\听力.apk' info = subprocess.check_output(cmd).split("\r\n") p…
def run(*popenargs, input=None, capture_output=False, timeout=None, check=False, **kwargs): """Run command with arguments and return a CompletedProcess instance. The returned instance will have attributes args, returncode, stdout and stderr…
[第六章]思考题答案,仅供参考: # coding:utf-8import time#方法一start_time = time.perf_counter()s = ''for n in range(0,100000): s +=str(n) end_time = time.perf_counter()print('time elapse:{}'.format(end_time - start_time)) print('*'*50) #方法二start_time = time.perf_coun…
# -*- coding:utf-8 -*- import os import sys import subprocess from uiautomator import device as d cmd = r'adb install E:\Project\A3A_8_4G\exercise\app_list\wps.apk' installinfo = subprocess.check_output(cmd).split("\r\n") if installinfo[0] == 'S…
#########sample########## sqlite3.OperationalError: Could not decode to UTF-8 column 'logtype' with text 将 with connection.cursor() as c: c.execute("select id,name from district_info where p_id=0") provinces = c.fetchall() 调整为 con = sqlite3.conn…
命名规则 变量 变量名只能是数字.字母或下划线的任意组合 变量名的第一个字符不能是数字 不能使用关键字作为变量名 变量的定义要具有可描述性 变量名不宜过长.不宜使用中文.拼音 常量(常用在配置文件中) 程序运行过程中不会改变的量,即常量.全部字母大写(约定俗成). 书写形式 驼峰体(类名) 下划线方式(函数名) 引号的使用 单引号和双引号用法作用相同,只是在同行代码中有较多引号时需要单引双引交叉使用,以此来方便让解释器和程序员区分所作用域. 格式化输出 %s就是代表字符串占位符,除此之外,还有%…
编码和解码是针对数据而言的,数据能干什么呢?无非就是用来显示,储存和传输的: 储存和传输数据当然是希望数据越小越好,所以发明了utf-8这种数据编码显示:它智能将英文用一个字节表示,欧洲的字符用两个字节表示,中文用三个字节表示. 数据显示的话不需要考虑数据的大小呢!因此统统采用国际标准的unicode标准来显示,每个字符都占用两个字节.无论是中文还是英文还是其他什么国家的文字. 数据你想显示,大小无所谓,那就用国际标准的呗,也就是unicode, 所以说你在打字时,屏幕上显示的都是用unicod…
wget https://www.python.org/ftp/python/3.6.4/Python-3.6.4.tgz 解压:tar -xzvf Python-3.6.4.tgz cd Python-3.6.4 /usr/local 创建一个文件夹:mkdir /usr/local/python3 编辑安装: makemake install 不要覆盖老版本,将老版本的名字修改下 mv /usr/bin/python /usr/bin/python_old 再建立新版本python的链接 l…
centos7安装Python3的过程中会和Python2.7版本冲突导致yum版本比对应,致使yum不能使用的问题. 原因:yum调用Python,启动程/usr/bin/yum就是一个python脚本.yum是不兼容python2.7的,所以yum不能正常工作,需要指定yum对应的Python版本. 解决方法:将文件/usr/bin/yum头部的#!/usr/bin/python改为#!usr/bin/python2.6.2(或者改为实际对应的版本)…
https://www.cnblogs.com/paladinzxl/p/6919049.html # python3.6的安装 wget https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tgz tar -zxvf Python-3.6.0.tgz cd Python-3.6.0 ./configure make make install # python3.6的验证 python3 # 创建虚拟环境 mkdir py3_env cd p…