摘要: port – Device name or None. baudrate (int) – Baud rate such as 9600 or 115200 etc. bytesize – Number of data bits. Possible values: FIVEBITS, SIXBITS, 阅读全文
posted @ 2017-11-27 14:16 njuptlwh 阅读(2139) 评论(0) 推荐(0) 编辑
摘要: 转义字符描述 \(在行尾时) 续行符 \\ 反斜杠符号 \' 单引号 \" 双引号 \a 响铃 \b 退格(Backspace) \e 转义 \000 空 \n 换行 \v 纵向制表符 \t 横向制表符 \r 回车 \f 换页 \oyy 八进制数,yy代表的字符,例如:\o12代表换行 \xyy 十六进制数,yy代表的字符,例如:\... 阅读全文
posted @ 2017-11-13 15:52 njuptlwh 阅读(102) 评论(0) 推荐(0) 编辑
摘要: Python ljust()方法 --rjust())#返回一个原字符串左对齐,并使用空格填充至指定长度的新字符串。如果指定的长度小于原字符串的长度则返回原字符串 str.ljust(width[, fillchar]) >>> ' hello world'.ljust(20) ' hello wo 阅读全文
posted @ 2017-11-13 10:07 njuptlwh 阅读(900) 评论(0) 推荐(0) 编辑
摘要: 1. Python isalnum()方法 #检测字符串是否由字母和数字组成 如果 string 至少有一个字符并且所有字符都是字母或数字则返回 True,否则返回 False >>> 'hello'.isalnum() True >>> 'hello123'.isalnum() True >>> 阅读全文
posted @ 2017-11-09 16:46 njuptlwh 阅读(176) 评论(0) 推荐(0) 编辑
摘要: 1. str.capitalize() # 将字符串的第一个字母变成大写,其他字母变小写。对于 8 位字节编码需要根据本地环境 >>> 'hello'.capitalize() 'Hello' >>> 'hEllo'.capitalize() 'Hello View Code 2. center(w 阅读全文
posted @ 2017-11-08 10:07 njuptlwh 阅读(316) 评论(0) 推荐(0) 编辑
摘要: #coding=utf-8 from multiprocessing import Process import os # 子进程要执行的代码 def run_proc(name): print 'Run child process %s (%s)...' % (name, os.getpid()) 阅读全文
posted @ 2017-09-26 14:43 njuptlwh 阅读(461) 评论(0) 推荐(0) 编辑
摘要: 方法一: # -*- coding:utf-8 -*- content = "我是中文" content_unicode = content.decode("utf-8") content_gbk = content_unicode.encode("gbk") print content_gbk 方 阅读全文
posted @ 2017-09-20 16:59 njuptlwh 阅读(404) 评论(0) 推荐(0) 编辑
摘要: Wolf_Electric_UI.py 1 # -*- coding: utf-8 -*- 2 3 # Form implementation generated from reading ui file 'wolf_electric.ui' 4 # 5 # Created: Mon Aug 28 阅读全文
posted @ 2017-09-07 10:11 njuptlwh 阅读(725) 评论(0) 推荐(0) 编辑
摘要: 第一种方法:in string = 'helloworld' if 'world' in string: print 'Exist' else: print 'Not exist' View Code 第二种方法:find 1 string = 'helloworld' 2 3 if string. 阅读全文
posted @ 2017-09-07 09:40 njuptlwh 阅读(388) 评论(0) 推荐(0) 编辑
摘要: python中时间日期格式化符号: %y 两位数的年份表示(00-99) %Y 四位数的年份表示(000-9999) %m 月份(01-12) %d 月内中的一天(0-31) %H 24小时制小时数(0-23) %I 12小时制小时数(01-12) %M 分钟数(00=59) %S 秒(00-59) 阅读全文
posted @ 2017-09-07 09:36 njuptlwh 阅读(201) 评论(0) 推荐(1) 编辑