Python的串口通讯第三方库PySerial
最近要用到串口通讯,简单易用的Python又帮上忙了,多亏了庞大的第三方资源~~~ :)
pySerial
Overview
This module encapsulates the access for the serial port. It provides
backends for Python running on Windows, Linux, BSD (possibly any POSIX
compliant system), Jython and IronPython (.NET and Mono). The module
named "serial" automatically selects the appropriate backend.
It is released under a free software license, see LICENSE.txt
for more details.
(C) 2001-2008 Chris Liechti cliechti@gmx.net
The project page on SourceForge
and here is the SVN repository
and the Download Page
.
The homepage is on http://pyserial.sf.net/
Features
same class based interface on all supported platforms
access to the port settings through Python 2.2+ properties
port numbering starts at zero, no need to know the port name in the user program
port string (device name) can be specified if access through numbering is inappropriate
support for different bytesizes, stopbits, parity and flow control with RTS/CTS and/or Xon/Xoff
working with or without receive timeout
file like API with "read" and "write" ("readline" etc. also supported)
The
files in this package are 100% pure Python. They depend on non standard
but common packages on Windows (pywin32) and Jython (JavaComm). POSIX
(Linux, BSD) uses only modules from the standard Python distribution)
The
port is set up for binary transmission. No NULL byte stripping, CR-LF
translation etc. (which are many times enabled for POSIX.) This makes
this module universally useful.
Requirements
Python 2.2 or newer
pywin32 extensions on Windows
"Java Communications" (JavaComm) or compatible extension for Java/Jython
Installation
from source
Extract files from the archive, open a shell/console in that directory and let Distutils do the rest:
python setup.py install
The files get installed in the "Lib/site-packages" directory.
easy_install
An EGG is ava
相关文档:
操作系统:linux debian 4.0, python版本2.5
s1:安装python2.5-dev。因为Python.h是在dev包中才有。
test@debian:~/test_python_c$ aptitude search python2.5-dev
p python2.5-dev - Header files and a static library for Python.
test@debian:~/test_python_c$ sudo aptitude install python2 ......
#Python字符串操作
''
'1.复制字符串'
''
#strcpy(
sStr1,
sStr2)
sStr1 =
'strcpy'
sStr2 =
sStr1
sStr1 =
'strcpy2'
print
sStr2
''
'2.连接字符串'
''
#strcat(
sStr1,
sStr2)
sStr1 =
'strcat'
sStr2 =
'append'
sStr1 +
=
sStr2
print
sStr1
''
'3.查找字符'
''
#strc ......
http://www.itzn.cn/html/jiaoben/python-perl-VBA/200812/19-3283.html
字符串是使用静态的方式进行存储,只能读而不能直接修改字符内容。特别将一堆对字符串并在一起的时候,虽然可以直接相加,听说这样的速度奇慢,只有用其它函数的方式进行,好在也不太麻烦。
比如用 print ','.join(datelist)
就可以将date ......
http://hbszyandong.javaeye.com/blog/377199
# -*- coding: utf-
8
-*-
from datetime import
datetime
from datetime import
date
from time import
strftime
from time imp ......
转自:http://hi.baidu.com/%C1%EE%BA%FC%CF%F3/blog/item/efb76fb7f0411dc437d3ca20.html
在本文中,以'哈'来解释作示例解释所有的问题,“哈”的各种编码如下:
1. UNICODE (UTF8-16),C854;
2. UTF-8,E59388;
3. GBK,B9FE。
一、python中 ......