随笔分类 -  python

摘要:函数释义 Python中默认安装的ftplib模块定义了FTP类,其中函数有限,可用来实现简单的ftp客户端,用于上传或下载文件,函数列举如下 FTP.quit()与FTP.close()的区别 FTP.quit():发送QUIT命令给服务器并关闭掉连接。这是一个比较“缓和”的关闭连接方式,但是如果 阅读全文
posted @ 2016-12-28 12:12 屌丝IT男 阅读(44500) 评论(3) 推荐(1) 编辑
摘要:import datetime #日期初始化: d1 = datetime.datetime(2005, 2, 16) d2 = datetime.datetime(2004, 12, 31) #日期相减: print (d1 - d2).days starttime = datetime.datetime.now() endtime = datetime.datetime.now() pr... 阅读全文
posted @ 2016-08-25 17:47 屌丝IT男 阅读(5966) 评论(0) 推荐(0) 编辑
摘要:import psycopg2 conn = psycopg2.connect(database="baoxin", user="odoo", password="odoo", host="127.0.0.1", port="5432") cur = conn.cursor() cur.execute("CREATE TABLE test(id serial PRIMARY KEY, num i... 阅读全文
posted @ 2016-08-20 17:25 屌丝IT男 阅读(1768) 评论(0) 推荐(0) 编辑
摘要:错误是由于从os模块引入了所有的函数导致的,os模块下有一个open函数,接受整型的文件描述符和打开模式,from os import *引入os模块的open函数,覆盖了python内建的open函数,导致错误。删除from os import *这行,然后再根据需要,指定引入os模块下的函数建议 阅读全文
posted @ 2016-07-17 15:12 屌丝IT男 阅读(31990) 评论(1) 推荐(2) 编辑
摘要:效果: 阅读全文
posted @ 2016-07-17 15:10 屌丝IT男 阅读(1006) 评论(0) 推荐(0) 编辑
摘要:貌似生成的url有问题,待优化。。。 阅读全文
posted @ 2016-07-17 13:47 屌丝IT男 阅读(234) 评论(0) 推荐(0) 编辑
摘要:很多时候要用命令行shell才能执行,可能是环境问题 效果: 阅读全文
posted @ 2016-07-17 13:04 屌丝IT男 阅读(146) 评论(0) 推荐(0) 编辑
摘要:# -*- coding=utf-8 -*- import sys import os import os.path import time import urllib.request, urllib.parse, urllib.error from threading import Thread local_proxies = {} class ThreadDownComplete... 阅读全文
posted @ 2016-07-17 12:27 屌丝IT男 阅读(184) 评论(0) 推荐(0) 编辑
摘要:# -*- coding=utf-8 -*- import re import string import urllib, urllib2 import os, sys import multiprocessing def getImageUrls(page): '''获取每个模块下的图片链接''' image_items = {} url_index = '... 阅读全文
posted @ 2016-07-16 18:39 屌丝IT男 阅读(395) 评论(0) 推荐(0) 编辑
摘要:结果: 阅读全文
posted @ 2016-06-30 16:57 屌丝IT男 阅读(862) 评论(0) 推荐(0) 编辑
摘要:这几天在折腾Python环境,显示把笔记本安装Ubuntu Linux环境系统,然后基本的Python环境都安装完毕之后需要安装传说中在其平台中最好的代码编辑和管理工具PyCharm,于是就根据网上的教程安装,但是在过程中还是会遇到各种的问题,所以今天把整个安装PyCharm过程都整理下来配上自己的 阅读全文
posted @ 2016-06-06 17:33 屌丝IT男 阅读(11875) 评论(0) 推荐(0) 编辑
摘要:# -*- coding: utf-8 -*- import math import re import csv import repr def ean_checksum(eancode): """returns the checksum of an ean string of length 13, returns -1 if the string has the wrong lengt... 阅读全文
posted @ 2016-05-24 23:29 屌丝IT男 阅读(2823) 评论(0) 推荐(0) 编辑
摘要:第一个图灵机器人接口实例: 第二个图灵机器人接口实例: 阅读全文
posted @ 2016-05-18 15:34 屌丝IT男 阅读(3175) 评论(0) 推荐(0) 编辑
摘要:运行结果:叁百肆拾叁元肆角伍分 阅读全文
posted @ 2016-04-21 23:05 屌丝IT男 阅读(4024) 评论(0) 推荐(0) 编辑
摘要:  阅读全文
posted @ 2016-03-14 18:03 屌丝IT男 阅读(2914) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示