易截截图软件、单文件、免安装、纯绿色、仅160KB

linux操作系统安装python3

首先是下载python3,现在的最高版本是3.1.1
for linux。
我的放置路径是/home/python下放置Python-3.1.1.tgz,执行以下系列操作:
1.解压:tar zxvf Python-3.1.1.tgz----生成解压包Python-3.1.1
2.转换到Python-3.1.1路径下,执行./configure
3.make
4.make install
在rehl5中已经默认安装了python2.4,所以要做如下操作:
#cd /usr/bin
#ll |grep python   //查看该目录下python
#rm -rf python
#ln -s PREFIX/
Python-3.1.1/python ./python  //PREFIX为你解压python的目录
#python
检测改正之后的python版本


相关文档:

Python入门的36个例子 之 19

源代码下载:下载地址在这里
# 022
listNum1 = [1, 3]
listNum2 = [2, 4]
listStr1 = ['a', 'c']
listStr2 = ['b', 'd']
# 列表的合并
list1 = listNum1 + listStr1
for ele in list1:
print ele
print '\n'
# 判断列表中是否包含某元素
print 'b' in list1
print 1 in list1
# 删除某个元素
for ele in ......

Python入门的36个例子 之 21

源代码下载:下载地址在这里
# 024
dict1 = {
'5064001':'Mememe',
'5064002':'tutu',
'5064003':'thrthr',
'5064004':'fofo'
}
print dict1['5064003']
# 也可以使用整型作为唯一的编号
dict2 = {
5064001:'Mememe',
506400 ......

Python入门的36个例子 之 25

源代码下载:下载地址在这里
# 028
consoleInput = raw_input('请输入点什么吧:')
aFile = file(r'C:\out.txt', 'w')
aFile.write(consoleInput + '\n')
aFile.write('这里是第二行')
aFile.close()

output:
>>>
请输入点什么吧:haha
>>>
......

Python入门的36个例子 之 34

源代码下载:下载地址在这里
raise有两个参数,第一个是由我们自己定义的异常类型,第二个是关于此异常的少量说明信息。
# 038
def getAge():
age = input('Input your age:')
if (age < 0 or age > 160):
raise 'BadAgeError', 'It is impossible!!!!!'
# end of if
return age
# ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号