本文转自:http://www.cnblogs.com/lonelycatcher/archive/2012/02/09/2343463.html这几天要用python发送邮件,上网找到这篇文章感觉蛮全面的,故转载收藏之。1. 文件形式的邮件#!/usr/bin/env python3 #codin...
分类:
编程语言 时间:
2015-08-17 00:53:22
阅读次数:
178
1.使用列表综合>>> listone = [2, 3, 4]
>>> listtwo = [2*i for i in listone if i > 2]
>>> print(listtwo)
[6, 8]
这里我们为满足条件(if i > 2)的数指定了一个操作(2*i),从而导出一个新的列表。注意原 来的列表并没有发生变化。在很多时候,我们都是使用循环来处理列表中的每一个元素,而使 用列表综...
分类:
编程语言 时间:
2015-08-16 12:28:14
阅读次数:
149
Python 3.4.3 (v3.4.3:9b73f1c3e601, Feb 24 2015, 22:43:06) [MSC v.1600 32 bit (Intel)] on win32Type "copyright", "credits" or "license()" for more info...
分类:
编程语言 时间:
2015-08-15 22:53:16
阅读次数:
162
Python 3.4.3 (v3.4.3:9b73f1c3e601, Feb 24 2015, 22:43:06) [MSC v.1600 32 bit (Intel)] on win32Type "copyright", "credits" or "license()" for more info...
分类:
编程语言 时间:
2015-08-15 22:43:35
阅读次数:
127
本节主要介绍python中循环语句的用法以及其他一些语句exec等,文章后面附有之前的文章;...
分类:
编程语言 时间:
2015-08-14 21:29:39
阅读次数:
210
闲的无事,看着知乎里种种python优点,按捺不住,装起python3.4。网上找了点爬行图片的代码,修改至兼容3.4,成功爬行指定url所有jpg图片,代码段如下:import osimport urllibimport urllib.requestimport re#爬行图片download_p...
分类:
编程语言 时间:
2015-08-14 17:01:53
阅读次数:
178
>>> from ctypes import *
>>> c_int()
c_long(0)
>>> c_char_p(b'hello')
c_char_p(b'hello')>>> c_ushort(-5)
c_ushort(65531)
>>> seitz = c_char_p(b'loves the python')
>>> print(seitz)
c_char_p(b'loves...
分类:
编程语言 时间:
2015-08-14 11:51:20
阅读次数:
223
一、重启系统,如图:GRUB:在引导装载程序菜单上,用上下方向键选择你忘记密码的那个系统键入“e”来进入编辑模式。2.接下来你可以看到如下图所示的画面,然后你再用上下键选择最新的内核(这里是第二行,kernel.......),然后在按“e”。3、在rhgb quiet后面加“空格”,然后键入“si...
分类:
其他好文 时间:
2015-08-14 11:14:05
阅读次数:
133
#!/usr/bin/python
# -*- coding:utf8 -*-import pymysql#取得数据库连接对象
conn = pymysql.connect(host='127.0.0.1',port=3306,user='root',passwd='1234',db='python')
#取得游标对象
cur = conn.cursor()#插入数据
cur.execute("IN...
分类:
数据库 时间:
2015-08-13 14:28:35
阅读次数:
1045