- 博客(170)
- 资源 (10)
- 收藏
- 关注

原创 【Python】Learn Python the hard way, ex40 模块,类和对象,这个解释比较容易理解
#coding:utf-8'''理解类和模块Python是一种面向对象编程(OOP)语言。这个说法的意思是,Python里边有一种叫做类(class)的结构,通过它可以用一种特殊的方法构造软件。通过使用类,可以让程序架构更为整齐,使用起来也更加干净 -- 至少理论上应该是这样的。首先,使用字典来帮助理解模块比如,定义以下一个字典mystuff = {'apple': "I AM
2015-10-17 17:38:18
1548

原创 GSM Channel Mode Modify和Channel Mode Modify Acknowledge信令
最近研究了下如何通过GSM Channel Mode Modify和Channel Mode Modify Acknowledge信令,获知GSM终端支持的data Rate 思路与原理:•In an RR connected state, acknowledges a CHANNEL MODE MODIFY message by sending a CHANNEL MOD
2013-09-20 23:09:49
2441

原创 【Python】如何在Windows 7 64位安装Python,并使用Matplotlib绘图
1.安装Python2.安装Matplotlib3.使用matplotlib绘图
2013-09-15 22:50:25
8038
转载 【Python】Python对list去重
使用list项作为键创建dict,这将自动删除任何重复项,因为dict不能有重复的键,保留原顺序。old_list = [2, 3, 4, 5, 1, 2, 3]new_list = list(dict.fromkeys(old_list))print(new_list) # [2, 3, 4, 5, 1]
2022-04-05 17:10:10
309
转载 【转载】Python + UIAutomator2的使用
简介uiautomator2是一个python库,用于Android的UI自动化测试,其底层基于Google uiautomator,Google提供的uiautomator库可以获取屏幕上任意一个APP的任意一个控件属性,并对其进行任意操作支持平台及语言你在python-uiautomator2封装了谷歌自带的uiautomator2测试框架,提供便利的python接口。他允许测试人员直接在PC上编写Python的测试代码,操作手机应用,完成自动化,大大提高了自动化代码编写的效率。工作原理
2022-03-07 16:34:43
5992
1
原创 【已解决】Python 3.7以上在Windows 10使用 pip install UnicodeDecodeError: ‘gbk‘ codec can‘t decode byte
Python 3.7以上在Windows 10使用 pip install UnicodeDecodeError: 'gbk' codec can't decode byte原因解决办法参考资料#Python 3.7以上在Windows 10使用 pip install UnicodeDecodeError: ‘gbk’ codec can’t decode byte在Win 10环境下,使用pip install -U weditor报错 File "C:\Python310\lib\emai
2022-02-27 21:32:04
7660
7
原创 Python+adb自动化测试
Python+adb自动化测试软件安装软件安装Pyhton发送adb合理的创建标题,有助于目录的生成如何改变文本的样式插入链接与图片如何插入一段漂亮的代码片生成一个适合你的列表创建一个表格设定内容居中、居左、居右SmartyPants创建一个自定义列表如何创建一个注脚注释也是必不可少的KaTeX数学公式新的甘特图功能,丰富你的文章UML 图表FLowchart流程图导出与导入导出导入软件安装软件安装1.VS Code: 链接,注意登录微软账号同步之前的设置,会自动安装插件,包括Python2.
2022-02-10 23:47:25
3744
原创 Python遍历处理文件
import osrootPath = r'D:\rssi'for root, dirs, files in os.walk(rootPath): for filePath in files: filePath = os.path.join(root, filePath) if filePath.find('-') > 0: pass else: print(filePath)
2021-08-21 22:31:39
228
原创 Python串口通信实战,计算BCC
#!/usr/bin/env python# coding=utf-8import serialimport timedef hexString2Bytes(str): str = str.replace(' ', '') return bytes.fromhex(str)def calBcc(ang1, ang2): #ang1 H, ang2 V list1 = [0, 0, 0, 0, 0, ang2] list1.append(ang1) lis
2021-08-21 22:30:40
407
原创 Python处理CSV,list计算标准差
#!/usr/bin/python# -*- coding: UTF-8 -*-import pandas as pdimport csvimport binasciiimport numpy as npimport osdef analysis_csv(filePath): list1 = [] with open(filePath, 'r', encoding = 'utf-8') as csvFile: #读取csv文件,返回的是迭代类型 reader1
2021-08-21 22:28:57
1148
原创 Python读写txt, xlsx文件实践
#!/usr/bin/env python3#-*-coding: UTF-8 -*-#Author 守望的距离import timeimport base64import openpyxlimport binasciifrom openpyxl import workbookdef decode_base64(dataIn): tempData = base64.b64decode(dataIn) bs = binascii.hexlify(bytearray(tem
2021-08-21 22:24:53
172
原创 Python播放音乐
Python播放音乐@TOCPython播放音乐使用pygame播放本地音乐去博客设置页面,选择一款你喜欢的代码片高亮样式,下面展示同样高亮的 代码片.// An highlighted blockimport pygameif __name__ == '__main__': pygame.mixer.init() print("播放音乐1") track = pygame.mixer.music.load("D:\\1.wav") pygame.mixer.
2021-08-21 22:19:32
831
原创 ROS小车踩坑记录
ROS小车踩坑记录2021/7/4最近喜欢上ROS小车了,终于有机会研究新技术了,有了前面树莓派,Ubuntu,STM32的折腾经历,这次上手很快,且整合了去年学到的很多知识点,实现了自己想了很久没有能实现的功能,虽然熬了一周的夜,但是内心很开心~~ROS小车踩坑记录:SLAM激光雷达,手动建图和多点导航,精度没有保证,且路线规划不可预知,不适合做10米内的定位,尝试了1天,最终放弃巡线导航,使用OpenCV和pid控制,OpenCV图像处理能力非常强,巡线只是简单的应用,还可以做车牌识别
2021-07-04 00:29:08
1682
原创 Beaglebone如何连接wifi
debian@beaglebone:~$ sudo connmanctlError getting VPN connections: The name net.connman.vpn was not provided by any connmanctl> tether wifi disableError disabling wifi tethering: Already disabledconnmanctl> enable wifiError wifi: Already enabled
2020-11-14 23:38:26
974
原创 Keil v5.11给STM32烧录程序记录
1)安装KeilMDK5112)安装ST Link下载器驱动3)打开Keil v5,加载工程文件4)load pack(Keil.STM32F1xx_DFP.1.1.0和Keil.STM32F0xx_DFP.1.2.0)5)编译程序- 0 Error(s), 0 Warning(s).6)烧录程序...
2020-03-19 00:07:44
5953
1
原创 Python print不换行
>>> for i in range(10): print('%3d' %i, end='') 0 1 2 3 4 5 6 7 8 9>>> data = [16, 25, 39, 27, 12, 8, 45, 63]>>> l = len(data)>>> l8>&g...
2020-01-30 19:03:48
326
原创 Python import
import 与 from...import在 python 用import或者from...import来导入相应的模块。将整个模块(somemodule)导入,格式为:import somemodule从某个模块中导入某个函数,格式为:from somemodule import somefunction从某个模块中导入多个函数,格式为:from somemodu...
2020-01-30 18:50:03
208
原创 VB能够快速解决问题,依然是伟大的工具
十年之后,碰到了一位业界高手,他负责芯片技术支持,自己有个VB6做的工具,控制MCU配置芯片协议栈,很慷慨的把源码和开发板一起给我了,今天花了一天时间,熟悉代码结构,并根据业务需求增加了读APDU list并自动连续发送,同时实现循环,方便压力测试。 突然找到了久违的感觉,晚上可以忙到1点半仍不知疲倦,代码调通那一刻,还是会兴奋的哼着小曲,有了源码,可以访问到任意字...
2019-11-09 22:46:49
359
原创 【C#】C#删除Excel整行,更新单元格内容
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;using System.Reflection;using Excel = Microsoft.Office.Interop.Excel;
2016-04-24 20:34:48
11596
原创 【Python】Python logging
Python内置模块logging管理不同级别log打印和存储,非常方便,从此告别了使用print打桩记录,我们来看下logging的魅力吧import logginglogging.basicConfig(level = logging.DEBUG, format = '%(asctime)s %(filename)s[line:%(lin
2016-04-01 23:00:09
815
转载 【Python】Python startswith, endswith
处理字符串时,startswith, endswith 2个函数比较方便,记下来他的基本用法。描述Python startswith() 方法用于检查字符串是否是以指定子字符串开头,如果是则返回 True,否则返回 False。如果参数 beg 和 end 指定值,则在指定范围内检查。语法startswith()方法语法:str.startswi
2016-04-01 22:39:31
2508
转载 C#程序调用cmd.exe执行命令
public class CmdHelper { private static string CmdPath = @"C:\Windows\System32\cmd.exe"; /// /// 执行cmd命令 /// 多命令请使用批处理命令连接符: /// <
2015-11-30 23:41:12
5707
转载 C# 执行bat批处理文件
转自http://www.cnblogs.com/zjfree/亲测可用 private void RunBat(string batPath) { Process pro = new Process(); FileInfo file = new FileInfo(batPath);
2015-11-30 22:37:59
8704
原创 【Python】if __name__ == "__main__":
经常在调试Python程序时,作为入口,需要写下如下这条语句,到底这条语句是什么意思呢?Python的模块有一些内置属性,用于完成特定的任务,如__name__ , __doc__同时,每个模块都有一个名词,例如, __name__用于判断当前模块是否是程序的入口,如果当前程序正在被使用,__name__的值为“__main__”if __name__ == "__main__
2015-11-29 07:51:12
599
转载 使用pyinstaller打包python为exe文件
最近用python的tkinter写了个windows界面的工具,用来对软件版本发布的自动化,之前发布版本是由PHP的同事完成,又是手动上传文件到ftp,又是修改数据库,php代码等这么多繁琐的步骤。所以决定用python写了个windows的应用,因为版本发布可能会交给运营的同事完成,所以用tkinter写了个界面,顺便转换成exe的文件,之前是用py2exe,觉得不好用,搜索到了pyinsta
2015-11-26 22:38:22
786
原创 This is cool...
Microsoft Windows XP [版本 5.1.2600](C) 版权所有 1985-2001 Microsoft Corp.C:\Documents and Settings\Administrator>python G:\get-pip.pyCollecting pip Downloading pip-7.1.2-py2.py3-none-any.whl (
2015-11-26 22:03:39
655
原创 【Python】Learn Python the hard way, ex50 第一个网站
利用lpthw.web框架实现"Hello World"网页版,代码如下:import weburls = ('/', 'index')app = web.application(urls, globals())render = web.template.render('templates/')class Index: def GET(self): gr
2015-11-23 21:26:05
1985
原创 【Python】 2种实现文件复制的方法
#coding:utf-8# 方法1:使用read()和write()模拟实现文件拷贝# 创建文件hello.txtsrc = file("hello.txt", "w")li = ["Hello world \n", "Hello China \n"]src.writelines(li)src.close()#把hello.txt 拷贝到hello2.txtsrc =
2015-10-18 13:36:33
13841
原创 【Python】三种遍历文件目录的方法
#coding:utf-8# 方法1:递归遍历目录import osdef visitDir(path): li = os.listdir(path) for p in li: pathname = os.path.join(path,p) if not os.path.isfile(pathname): #判断路径是否为文件,如果不
2015-10-18 13:14:13
5074
翻译 【Python】Learn Python the hard way, ex47 自动化测试,环境变量设置
class Room(object): def __init__(self, name, description): self.name = name self.description = description self.paths = {} def go(self, direction):
2015-10-18 10:25:59
1762
原创 【Python】Learn Python the hard way, ex46 项目骨架搭建练习
一个项目由多个py模块,类文件构成,在项目建立时,需要搭好架子本例子给出了一个很好的模板框架,供后续复制和直接使用1,首先,建立以下文件夹和py文件(其中NAME就是将来自己的项目名称)bogon:~ myRMBP$ mkdir projectsbogon:~ myRMBP$ cd projectsbogon:projects myRMBP$ mkdir skeletonb
2015-10-17 23:42:36
3309
原创 【Python】pip - 安装第三方包的神器
使用Python,肯定希望使用大量成熟的第三方包,从而快速用到自己的项目。还在一个个寻找,手动下载吗?pip就是这样一个神器,自动搜索、下载和安装第三方包:1,首先请安装pip自己,下载地址(也可以通过附件下载):http://www.pip-installer.org/en/latest/installing.html#python-os-support
2015-10-17 22:57:22
34763
翻译 【Python】Learn Python the hard way, ex42 对、类及从属关系
# Animal is-a object (yes, sort of confusing) look at the extra creditclass Animal(object): pass# is-aclass Dog(Animal): def __init__(self, name): ## has-a self.name = name
2015-10-17 21:58:15
1742
原创 【Python】Learn Python the hard way, ex41 面向对象术语练习
# coding:utf-8# 导入模块import randomfrom urllib import urlopenimport sys# 定义一个变量,字符串内容为一个urlWORD_URL = "http://learncodethehardway.org/words.txt"# 定义一个空列表WORDS = []# 定义一个字符串常量,内容为多个字符串PHRASE
2015-10-17 21:27:19
2048
原创 【Python】Learn Python the hard way, ex39 字典操作
# create a mapping of state to abbreviationstates = { 'Oregon': 'OR', 'Florida': 'FL', 'California': 'CA', 'New York': 'NY', 'Michigan': 'MI'}# create a basic set of states and
2015-10-14 22:55:42
765
原创 【Python】Learn Python the hard way, ex38 列表操作
ten_things = "Apples Oranges Crows Telephone Light Sugar"print "Wait there's not 10 things in that list, let's fix that."stuff = ten_things.split(' ')more_stuff = ["Day", "Night", "Song", "Frisb
2015-10-14 22:24:16
1150
翻译 【Python】if语句使用规则
Rules for If-StatementsEvery if-statement must have an else.If this else should never run because it doesn't make sense, then you must use a die function in the else that prints out an error m
2015-10-11 21:45:37
2872
原创 【Python】Learn Python the hard way, ex35 通过一个简单游戏,练习循环和分支语句
from sys import exitdef gold_room(): print "This room is full of gold. How much do you take?" next = raw_input("> ") if "0" in next or "1" in next: how_much = int(next)
2015-10-11 21:31:20
1460
原创 【Python】Learn Python the hard way, ex33 while循环
i = 0numbers = []while i < 6: print "At the top i is %d" % i numbers.append(i) i += 1 print "Numbers now: ", numbers print "At the bottom i is %d" % iprint "The numbers: "fo
2015-10-11 21:03:52
821
海外运营商准入NFC测试标准GSMA TS.27
2017-04-04
ISO 10373-6 2010 NFC射频测试标准
2017-04-04
C#删除Excel行实例,Microsoft.Office.Interop.Excel
2016-04-24
使用NeatUpload控件实现ASP.NET大文件上传
2015-12-21
《C# 2.0实例自学手册 通过200个例子掌握Web开发捷径》一书配套光盘
2013-05-12
2010年考研政治大纲变动,任汝芬解析大纲变动
2009-09-20
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人