Python的字符串
Python中字符串被定义为引号之间的字符集合。Python支持使用成对的单引号或双引号,三引号包含的字符串。
使用索引操作符([])和切片操作符([:])可以得到子字符串。字符串有其特有的索引规则:第一个字符的索引是0
,最后一个字符的索引是-1。
加号(+)用于字符串连接运算,星号(*)则用于字符串重复。如下例:
pystr = "Python"
pystr[2:5]结果为:tho
'''
Created on 2010-1-12
@author: cuser
'''
s = "abcd"
'''
print(s[0])
print(s[1])
print(s[2])
print(s[3])
print(s[-1])#最后一个字符的索引为-1
'''
print(s[0:1])
print(s[0:2])
print(s[2:3])
print(s[:2])
print(s[2:])
print(s*2)
print(s*3)
结果如下:
a
ab
c
ab
cd
abcdabcd
abcdabcdabcd
相关文档:
threading — Higher-level threading interface
This module constructs higher-level threading interfaces on top of the lower level _thread module. See also the queue module.
The dummy_threading module is provided for situations where threading cannot be used because _thread is missing.
......
multiprocessing — Process-based “threading” interface
Introduction
multiprocessing is a package that supports spawning processes using an API similar to the threading module. The multiprocessing package offers both local and remote concurrency, effectively side-stepping the Glo ......
RRD是Round Robin Database的意思,RRDTool是用来管理RRD的一个工具。RRDTool的主页在这里,Wikipedia的页面在这里。RRD其实就是一个时序数据库,使用一个固定大小的环型buffer,适用于存储一些统计性的信息,如CPU负载呀,气温变化呀。我为什么要说这个东西呢,因为XenServer里的性能统计是用的RRD,你可以访问诸如http:// ......
Python 3 是 Guido van Rossum 功能强大的通用编程语言的最新版本。它虽然打破了与 2.x 版本的向后兼容性,但却清理了某些语法方面的问题。本文是系列文章中的第一篇,介绍了影响该语言及向后兼容性的各种变化,并且还提供了新特性的几个例子。
Python 版本 3,也被称为 Python 3000 或 Py3K(仿效 Microsoft® Windows ......
转载自:http://purpen.javaeye.com/blog/98095
python 执行系统命令比较
关键字: python os system 系统命令
在此比较一下两种方法执行系统命令的方法,以方便于日后运用:(
1. os.system()
system(command) -> exit_status
Execute the  ......