python打印电脑串口的信息

 1 # -*- coding:utf-8 -*-
 2
 3 from serial.tools.list_ports import comports
 4
 5 port_list = list(comports())
 6 if len(port_list) == 0:
 7     print(‘Not found Serial Ports‘)
 8 else:
 9     for i in range(len(port_list)):
10         print(port_list[i])  #print the serial port infomation

原文地址:https://www.cnblogs.com/TwCsLj/p/10556720.html

时间: 2024-08-02 03:18:33

python打印电脑串口的信息的相关文章

python打印详细的异常信息

#!/usr/bin/env python #coding=utf-8 import traceback try: 1/0 except Exception, e: print e print traceback.format_exc() python打印详细的异常信息,布布扣,bubuko.com

打印简单公司员工信息表

要求,输入name不为空,输入次数最多3次,3次后跳出程序: 知识点: raw_input str转int whil if elif else continue break for 导入模块 引用变量值 格式化输出 vim #!/usr/bin/env python import sys user_name = "carson" this_year = 2014 counter  = 0 while True:     if counter < 3:         name =

用python打印各种图形

#用python打印出直角三角形:   1 #!/usr/bin/env python   2 # coding=utf-8   3 i = 0   4 while i < 5:   5     j = 0   6     while j <= i:   7         print "*",   8         j+=1   9     print ""  10     i+=1                 输出效果如下: *  * *  *

使用RXTX获取电脑串口

RXTX是javacomm串口通信的一个扩展 RXTX开发所需文件的下载地址:http://rxtx.qbang.org/wiki/index.php/Download 解压之后可以看到支持各个平台的文件夹: 如果java的安装路径为D:\java\jre7,则将选中的文件夹中的rxtxSerial.dll复制到D:\java\jre7\bin\,       将RXTXcomm.jar复制到D:java\jre\lib\ext\ 然后在项目的lib包中引入RXTXcomm.jar. 1 /**

Raspberry pi 使用python+pySerial实现串口通信(转)

Raspberry pi 使用python+pySerial实现串口通信 转:http://blog.csdn.net/homeway999/article/details/8642353 目录(?)[+] Raspberry pi 使用pythonpySerial实现串口通信 Raspberry pi端安装pyserial 方法1source安装 方法2pip安装 Raspberry pi端连接串口 Windows端连接串口 Raspberry pi 使用python+pySerial实现串口

python打印表格式数据,留出正确的空格和段落星号或注释

python打印表格式数据,留出正确的空格,格式化打出 代码如下: def printPicnic(itemsDict,leftWidth,rightWidth): print('PICNIC ITEMS'.center(leftWidth + rightWidth,'-')) for k,v in itemsDict.items(): print(k.ljust(leftWidth,'.')+str(v).rjust(rightWidth)) picnicItems = {'sandwitch

C#获取电脑的相关信息

/* 创建者:菜刀居士的博客 * 创建日期: 2014年08月31号 * 功能:获取电脑的相关信息 * */ namespace Net.String.ConsoleApplication { using System; using System.Management; public class ComputerHelper { /// <summary> /// 获取CPU序列号代码 /// </summary> public static string GetCPUId() {

python使用psutil获取服务器信息

>>> import psutil 获取cpu信息>>> psutil.cpu_times()scputimes(user=128258.38, nice=12.29, system=88369.31, idle=6713420.33, iowait=3290.63, irq=1069.04, softirq=3368.56, steal=0.0, guest=0.0) >>> psutil.cpu_times().idle 6717807.87 获取

使用pyinstaller 2.1将python打包并添加版本信息和图标

最近用 wxpython写了一个小的脚本,因为想要发布给没有装python和wxpython的人使用,遂决定使用pyinstaller 2.1进行打包. 其中遇到几个问题: 1,给打包的文件添加图标 查看pyinstaller 的操作手册很容易发现: -i <FILE.ico>, -i <FILE.exe,ID>, --icon=<FILE.ico>, --icon=<FILE.exe,ID>   Add an icon to the output exec