Pythonµ¼³öQQ¿Õ¼äµÄÈÕÖ¾
ÓÃPythonµ¼³öQQ¿Õ¼äµÄÈÕÖ¾µ½WordPress
ÎÄÕÂÀ´Ô´£ºhttp://www.keakon.cn/bbs/thread-964-1-1.html·½·¨ºÜ¼òµ¥£¬ÕÒ³öÈÕÖ¾µÄµØÖ·£¬ÔÙ±éÀúÁгöÈÕÖ¾µÄÄÚÈÝ¡£
ÒòΪµ¥´¿µ¼³öûÓ㬻¹µÃת»»³ÉÆäËû¸ñʽ£¬ËùÒÔÎÒ±£´æµ½Ò»¸öÁбíÀÿƪÈÕÖ¾¶¼¶ÔÓ¦ÆäÖеÄÒ»¸ö×ÖµäÔªËØ£¬×ÖµäµÄÊôÐÔ¶¼ÓÃunicode±àÂë¡£
È»ºódump³öÀ´£¬¿ÉÒÔ·½±ãÒÔºóÓÃPython½øÐÐÔÙ´¦Àí£¨Ä¬ÈÏΪblogs.txtÎļþ£©¡£
²¢×ª»»³ÉÁËWordPressÓõĸñʽ£¨Ä¬ÈÏΪqzone.xmlÎļþ£©¡£
±¾ÏëÓöàÏß³ÌÀ´ÏÂÔØ£¬µ«Ëƺõû±ØÒª£¬ÒòΪֻ»¨ÁË80Ã룬ÎÒµÄ149ƪÈÕÖ¾¾ÍÈ«²¿ÏÂÔØÏÂÀ´ÁË¡£
Èç¹û¿Õ¼äÓÐÉèÖ÷ÃÎÊȨÏ޵Ļ°£¬¿ÉÒÔÓÃClientCookieÕâ¸öÄ£¿éÀ´´¦Àí£¬°Ñ×¢Ê͸ÄϾÍÐÐÁË¡£
´ËÍ⣬Õâ¸öÒ²¿ÉÒÔµÁÈ¡±ðÈ˵ÄÈÕÖ¾£¬µ«Ô¸²»ÒªÀÄÓÃ…
×îºó£¬ÆÀÂÛÎÒûÏÂÔØ£¬ÒòΪWordPressºÃÏñ²»Äܵ¼ÈëÆÀÂÛ¡£
´úÂëÈçÏ£º
# -*- coding: gbk -*-
from __future__ import with_statement
import codecs
from datetime import datetime
from datetime import timedelta
from os import linesep
import cPickle
#import ClientCookie
from urllib2 import urlopen
mainUrl = 'http://%s.qzone.qq.com/'
listUrl = 'http://b.qzone.qq.com/cgi-bin/blognew/blog_output_toppage?uin=%(qq)s&vuin=0&property=GoRE&getall=1&imgdm=imgcache.qq.com&bdm=b.qzone.qq.com&cate=&numperpage=100&sorttype=0&arch=0&pos=%(pos)d&direct=1'
blogUrl = 'http://qzone.qq.com/blog/%(qq)s-%(blogid)s'
GMT_FORMAT = '%a, %d %b %Y %H:%M:%S +0800'
HEADER = u'''<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
xmlns:excerpt="http://wordpress.org/export/1.0/excerpt/"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:wp="http://wordpress.org/export/1.0/"
>
<channel>
<title>%(author)sµÄQQ¿Õ¼ä</title>
<description>%(description)s</description>
<pubDate>%(time)s</pubDate>
<generator>keakonµÄQQ¿Õ¼äµ¼³ö³ÌÐò</generator>
<language>zh-CN</language>
<wp:wxr_versio
Ïà¹ØÎĵµ£º
´úÂëÈçÏ£º
#!/usr/bin/env python
# -*-coding:UTF-8-*-#
from common import *
import Image, ImageFilter, math, sys, os, random
def modifyImageObj(img, matrix) :
width, height = img.size
for h in range(0, height) :&n ......
ÔÚparamikoÖÐʹÓÃÓû§ÃûºÍÃÜÂëͨ¹ýsftp´«ÊäÎļþ£¬²»Ê¹ÓÃkeyÎļþ¡£
import getpass
import select
import socket
import traceback
import paramiko
def putfile():
#import interactive
# setup logging
paramiko.util.log_to_file('demo.log')
username = username
hostname = hostname
......
python ÖÐminidom½âÎöxml
2009Äê06ÔÂ26ÈÕ ÐÇÆÚÎå 08:40
ÏÂÃæÖ»ÁгöһЩ³£Óõķ½·¨ÊôÐÔ£¬Èç¹ûÒª²é¿´¸ü¶àµÄ·½·¨£¬ ¿ÉÒÔÈ¥¿´ÎļþminidomÈçºÎʵÏֵġ£
»ñµÃDocument¶ÔÏó
·¨Ò»£º
import xml.dom.minidom as m_dom
doc1 = m_dom.getDOMImplementation().createDocument(None, "root1", None)
doc1.documentElement.toxml(e ......
ÔÎÄÁ´½Ó
Ôø¾ÔÚÉîÈëdz³öjavaÖÐÎÄÎÊÌâ
ϵ
ÁÐÖÐÑо¿¹ýjavaµÄÖÐÎÄÎÊÌ⣬ÏÖÔÚÖÐÎÄÎÊÌâÒѾ²»ÔÙî¿°íÎÒÔÚjavaÊÀ½çÖÐÂþÓεĽŲ½ÁË¡£×î½ü£¬¶ÔPython²úÉúÁËŨºñµÄÐËȤ£¬ËÖªµÀ¸úÖÐÎÄÎÊÌâÕâ¸ö
ÀÏÅóÓÑÓÖÒ»´Î²»ÆÚ¶øÓö¡£¿´À´£¬ÔÚ´úÂëÊÀ½çÖУ¬ÖÐÎÄÎÊÌâ»áÔںܳ¤Ò»¶Îʱ¼äÀï¸úÎÒÃÇÐÎÓ°²»Àë¡£ÕâÒ²Äѹ֣¬Ë ......
1. Python ´®¿ÚÉ豸ӦÓÃ
¼òÊö
1.1. Ïß³ÌÂÖÑ°
·ç³¾ÎÞÏÞ <tianyu263@163.com>
-- ·ÖÏí
¾ÍÊÇ´ò¿ª´®¿Úºó£¬Æô¶¯Ò»¸öÏß³ÌÀ´¼àÌý´®¿ÚÊý¾ÝµÄ½øÈ룬ÓÐÊý¾Ýʱ£¬¾Í×öÊý¾ÝµÄ´¦Àí£¨Ò²¿ÉÒÔ·¢ËÍÒ»¸öʼþ£¬²¢Ð¯´ø½ÓÊÕµ½µÄÊý¾Ý£©¡£
Toggle line numbers
1
2 #coding=gb18030
3
4 i ......