为Python3作准备 在开始添加Python 3的支持前,为了能够尽可能地顺利过度到Python 3,你应该通过修改对2to3来说很难苦的东西来给你的代码做一些准备。即使你现在不打算迁移到Python 3,有一些事你也可以现在就做,...
分类:
编程语言 时间:
2015-09-15 18:36:18
阅读次数:
264
环境:ubuntu,python3.41.问题一:以下语句语句是取每行的头元素,其中line应该是一个列表。问题是,line在实际运行中已经不是列表,而变成了列表中的头元素。 {key:line[0] for key,line in list_info.items() if len(line)>0}
分类:
编程语言 时间:
2015-09-15 10:57:55
阅读次数:
144
使用命令:$ sudo yum search PIL | grep python3可显示得知:python3-dogpile-cache.noarch : A caching front-end based on the Dogpile lock.python3-dogpile-core.noarc...
分类:
编程语言 时间:
2015-09-13 19:57:30
阅读次数:
870
题目来源: Conditions and Loops 1 #!/usr/bin/python3 2 # sum all odds between two positive integer 3 4 a = int(input("Please input one positive integer > ....
分类:
其他好文 时间:
2015-09-12 12:04:54
阅读次数:
139
#!/usr/bin/python3import timeimport pymssqlimport urllib.parseimport httplib2import os.pathimport xml.etree.ElementTreeimport cx_Oraclev_curr_datetime...
分类:
数据库 时间:
2015-09-11 12:41:03
阅读次数:
241
迁移策略 制作一个向后不兼容的软件版本是有很高风险的。 当人们需要重写他们的软件或者为了支持两个语言或框架的版本维护割裂的版本时, the risk is that they never make the transition and stay on the old ...
分类:
编程语言 时间:
2015-09-10 11:22:05
阅读次数:
305
一、文件形式的邮件#!/usr/bin/env python3#coding: utf-8import smtplibfrom email.mime.text import MIMETextfrom email.header import Headersender = '***'receiver =...
分类:
编程语言 时间:
2015-09-07 12:25:02
阅读次数:
194
在Python2中map函数会返回一个list列表,如代码:>>> def f(x, y): return (x, y) >>> l1 = [ 0, 1, 2, 3, 4, 5, 6 ] >>> l2 = [ 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', '.....
分类:
编程语言 时间:
2015-09-05 23:42:54
阅读次数:
323
安装Python window下载安装Python python官网地址:https://www.python.org/ 进入官网下载python客户端,现最新的python是python3.5。因python2.x与3.x之间还是有一些区别的,且使用上不全兼容,因此本人下载的为...
分类:
编程语言 时间:
2015-09-05 22:24:42
阅读次数:
216
Python官方提供了用于编写网络爬虫的包 urllib.request, 我们主要用它进行打开url,读取url里面的内容,下载里面的图片。分以下几步:step1:用urllib.request.urlopen打开目标网站step2:由于urllib.request.urlopen返回的是一个ht...
分类:
编程语言 时间:
2015-09-03 23:18:09
阅读次数:
466