pythonµ¼³öÓÊÏäÀïµÄÁªÏµÈË£¬Ö§³ÖGmailµÈ
PythonÓïÑÔ
: µ¼³öÓÊÏäÀïµÄÁªÏµÈË£ºÖ§³ÖGmail£¬126£¬ÍøÒ×£¬ËѺü£¬Hotmail£¬ÐÂÀË£¬ÑÅ»¢£¬MSN
#!/usr/bin/env python
#coding=utf-8
from
BeautifulSoup
import
BeautifulSoup
import
os
,
urllib
,
urllib2
,
pdb
import
cookielib
import
httplib
import
csv
,
re
GDATA_URL
=
'/accounts/ClientLogin'
class
MailContactError
(Exception
):
pass
class
MailContact
:
def
__init__
(self
,
username
,
password
):
pass
def
login
(self
):
pass
def
get_contacts
(self
):
pass
def
get_contact_page
(self
):
pass
class
GMailContact
(MailContact
):
"""
A class to retrieve a users contacts from their Google Account.
Dependencies:
-------------
* BeautifulSoup.
* That's it. :-)
Usage:
------
>>> g = GMailContact('email@example.org', 'password')
>>> g.login()
(200, 'OK')
>>> g.get_contacts()
>>> g.contacts
[(u'Persons Name', 'name@person.com'), ...]
"""
def
__init__
(self
,
username
=
'test@gmail.com'
,
password
=
'test'
,
service
=
'cp'
):
self
.
mail_type
=
"@gmail.com"
self
.
username
=
username
+
self
.
mail_type
self
.
password
=
password
 
Ïà¹ØÎĵµ£º
Google½«ÏÞÖÆPythonÓïÑÔµÄÓ¦Óà ¿ª·¢ÉçÇøÈÈÒé
¸ÐлÂ̲ÝÐÇ¿ÕµÄͶµÝ
ÐÂÎÅÀ´Ô´:CSDN
Collin WinterÊÇPythonÉçÇøһλÆľßÓ°ÏìÁ¦µÄ¿ª·¢Õߣ¬ËûÔøÊÇCPythonÏîÄ¿µÄºËÐÄ¿ª·¢ÕßÖ®Ò»¡¢Ò²ÔøÊÇUnladen Swallow£¨¼ûÎÄĩעÊÍ£©µÄºËÐÄ¿ª·¢Õߣ¬²ÎÓëÁ˺ܶàPythonÏîÄ¿µÄ¿ª·¢¡£½üÀ´´«ÎÅGoogle½«ÔÚÆäÐÂÏîÄ¿ÖÐÏÞÖÆPythonµÄʹÓã¬Îª´ËÓп ......
Ê×ÏÈÒª¸ãÇå³þ£¬×Ö·û´®ÔÚPythonÄÚ²¿µÄ±íʾÊÇunicode±àÂ룬Òò´Ë£¬ÔÚ×ö±àÂëת»»Ê±£¬Í¨³£ÐèÒªÒÔunicode×÷ΪÖмä±àÂ룬¼´ÏȽ«ÆäËû±àÂëµÄ×Ö·û´®½âÂ루decode£©³Éunicode£¬ÔÙ´Óunicode±àÂ루encode£©³ÉÁíÒ»ÖÖ±àÂë¡£
decodeµÄ×÷ÓÃÊǽ«ÆäËû±àÂëµÄ×Ö·û´®×ª»»³Éunicode±àÂ룬Èçstr1.decode('gb2312')£¬±íʾ½«gb2312±àÂëµÄ×Ö·û´®×ª» ......
>>> import copy
>>> a = [1,2,3,4,['a','v']]
>>> b = a
>>> b
[1, 2, 3, 4, ['a', 'v']]
>>> c = copy.copy(a)
>>> c
[1, 2, 3, 4, ['a', 'v']]
>>> d = copy.deepcopy(a)
>>> d
[1, 2, 3, 4, ['a', 'v']]
>>> a.append(5) ......
°æȨÉùÃ÷
£º×ªÔØʱÇëÒÔ³¬Á´½ÓÐÎʽ±êÃ÷ÎÄÕÂÔʼ³ö´¦ºÍ×÷ÕßÐÅÏ¢¼°±¾ÉùÃ÷
http://mobile2008.blogbus.com/logs/28725962.html
°²×°ºÃÖ®ºó£¬Ä£¿éÃû×Ö½Ð×öMySQLdb £¬ÔÚWindowºÍLinux»·¾³Ï¶¼¿ÉÒÔʹÓã¬ÊÔÑéÁËÒ»ÏÂͦºÃÓã¬
²»¹ýÓÖ·¢ÏÖÁË·³È˵ÄÂÒÂéÎÊÌ⣬×îºóÓÃÁ˼¸¸ö°ì·¨£¬½â¾öÁË£¡
ÎÒÓÃÁËÏÂÃ漸¸ö´ëÊ©£¬±£Ö¤MySQL ......
±àÒëPython½Å±¾Éú³É¿ÉÖ´ÐгÌÐò£¬¿ÉÒÔͨ¹ýpy2exe±àÒëÍê³É¡£
ÔÚVCÖе÷ÓÃpythonʱ£¬¿ÉÒÔ½áºÏpy2exe£¬Íê³ÉÕû¸ö³ÌÐòµÄ¶ÀÁ¢·¢²¼^_^
google.py:
#! /usr/bin/env python
import sys, webbrowser
def main(a):
url = "http://www.google.com/search?q=%s" % a
webbrowser.o ......