码迷,mamicode.com
首页 >  
搜索关键字:python email from to    ( 191911个结果
Python重定向到文件
1.方式1__file__ = open(r'log.txt', 'a')print >>__file__, "hello, world!"__file__.close()2.方式2__stdout__ = sys.stdoutsys.stdout = open(r'log.txt', 'a')pr...
分类:编程语言   时间:2015-06-29 21:58:26    阅读次数:788
hdu 1973 Prime Path
题目连接http://acm.hdu.edu.cn/showproblem.php?pid=1973Prime PathDescriptionThe ministers of the cabinet were quite upset by the message from the Chief of ...
分类:其他好文   时间:2015-06-29 21:58:12    阅读次数:111
Python 浅拷贝和深拷贝
一、前奏:熟悉Python内存管理在Python中,变量在第一次赋值时自动声明,在创建---也就是赋值的时候,解释器会根据语法和右侧的操作数来决定新对象的类型。引用计数器:一个内部跟踪变量引用计数:每一个对象各有多少个引用当对象被创建并(将其引用)赋值给变量时,该对象的引用计数就被设置为 1>>> ...
分类:编程语言   时间:2015-06-29 21:53:14    阅读次数:131
pyglet -- 视频播放器 (简单实现,效果不是太好,切换资源会卡死)(三)
实现一个简单的视频播放器,效果不是很好。这里不多说,直接贴代码了。 1 #-*- coding:gbk -*- 2 import pyglet 3 import os 4 from pyglet.gl import * 5 6 def draw_rec(x,y,width,height...
分类:其他好文   时间:2015-06-29 21:47:46    阅读次数:211
python dict排序
按值排序,reverse=True为从大到小排序dic={‘a‘:31,‘bc‘:5,‘c‘:3,‘asd‘:4,‘aa‘:74,‘d‘:0}dic=sorted(dic.iteritems(),key=lambdad:d[1],reverse=True)按key排序dic=sorted(dic.iteritems(),key=lambdad:d[0])生成的结果为元组
分类:编程语言   时间:2015-06-29 20:41:57    阅读次数:189
python 解析XML xml.dom
一 、xml.dom 解析XML的API描述 minidom.parse(filename) ? 加载读取XML文件 doc.documentElement ? 获取XML文档对象 node.getAttribute(AttributeName) ? 获取XML节点属性值 node.getElementsByTagName(TagN...
分类:编程语言   时间:2015-06-29 20:41:48    阅读次数:147
python 点滴记录12:异常处理
引入异常处理机制,使得运行的程序发生错误时,不至于崩溃。常见格式:try: command1 except: command2当command1执行出错时,就会执行command2。command2通常是自己定义的错误提示或者系统默认的提示。eg:#!/usr/bin/python while1: c=raw_input("input‘c‘continue,otherwis..
分类:编程语言   时间:2015-06-29 20:38:14    阅读次数:186
Leetcode41: Remove Duplicates from Sorted List
Given a sorted linked list, delete all duplicates such that each element appear only once. For example, Given 1->1->2, return 1->2. Given 1->1->2->3->3, return 1->2->3. /** * Definition for sin...
分类:其他好文   时间:2015-06-29 20:28:58    阅读次数:98
LeetCode_Construct Binary Tree from Preorder and Inorder Traversal
LeetCode_Construct Binary Tree from Preorder and Inorder Traversal 解题思路...
分类:其他好文   时间:2015-06-29 20:27:59    阅读次数:76
LeetCode_Construct Binary Tree from Inorder and Postorder Traversal
LeetCode_Construct Binary Tree from Inorder and Postorder Traversal 解题思路...
分类:其他好文   时间:2015-06-29 20:26:47    阅读次数:82
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!