Python PAMIEʾÀý
ת×Ô:http://blog.chinaunix.net/u3/103146/showart_2058891.html
PythonÕâÖֽű¾ÓïÑÔµÄÇ¿´ó¹¦ÄÜÔ½À´Ô½±»¹ã´óµÄ³ÌÐòÔ±ËùÖØÊÓ£¬ÕâÖÖ֮ǰÔÚ¹úÄÚÁ÷ÐжȲ»¸ßµÄÓïÑÔ½üÀ´ÆøÊƸßÕÇ¡£¸÷ÖÖµÚÈý·½Ä£¿é²ã³ö²»Çî¡£
±¾ÎĽéÉܵıãÊÇÒ»ÖÖÄܷdz£·½±ã²Ù×÷IEµÄµÚÈý·½¹¤¾ß£¬PAMIE£¬ËûÄÜÈÃÄãÈçͬдJSÒ»ÑùÀ´²Ù×÷IEä¯ÀÀÆ÷¡£°üÀ¨×Ô¶¯Æô¶¯£¬·ÃÎÊÁ´½Ó£¬ÉèÖÃÎı¾¿òÖµ£¬»ñÈ¡°´Å¥£¬Ö´Ðеã»÷ʼþ£¬ÉõÖÁÖ´ÐÐÒ³ÃæJS·½·¨µÈµÈ¡£ÏÂÃæÓÃÒ»¸öʵ¼ÊµÄÀý×ÓÏê¼Ó˵Ã÷:
ÒÔϼò¶Ì´úÂë±ãÇáÒ×ʵÏÖ£¬µÇ¼±¾ÈËChinaUnix£¬²¢ÒԴ˵ã»÷ÈÕÖ¾ÎÄÕ£¬·¢ÎÄÕ£¬ÉèÖñêÌ⣬·ÖÀ࣬ºÍ²©¿ÍÄÚÈÝ£¬×îºóÖ´ÐÐÈ·¶¨£¬·¢²¼³É¹¦¡£
# -*- coding: gb2312 -*-
from PAM30 import PAMIE
from string import split
#===============================================================================
# ´ÓÎļþ¶ÁÈ¡ÅäÖÃÐÅÏ¢£¬µÇ¼url,ÕË»§£¬ÃÜÂëµÈ
#===============================================================================
def getCfgfromFile(fileName='settings.txt'):
file = open(fileName)
dict = {}
line = file.readline()
while line != '':
args = split(line, '=')
dict[args[0]] = args[1].decode('utf-8').encode('gb2312')
line = file.readline()
return dict
dict = getCfgfromFile()
ie = PAMIE()
#===============================================================================
# ´ò¿ªµÇÂ¼Ò³Ãæ£¬ÉèÖÃÓû§/ÃÜÂë
#===============================================================================
ie.navigate(dict['login-url'])
ie.setTextBox('username', dict['username'])
ie.setTextBox('password', dict['password'])
#===============================================================================
# »ñÈ¡µÇ¼°´Å¥
#===============================================================================
loginbtn = ie.findElement('input', 'type', 'image')
ie.clickElement(loginbtn)
#===============================
Ïà¹ØÎĵµ£º
1 ÄãºÃ
#´ò¿ªÐ´°¿Ú,ÊäÈë:
#! /usr/bin/python
# -*- coding: utf8 -*-
s1=input("Input your name:")
print("ÄãºÃ,%s" % s1)
'''
֪ʶµã:
* input("ij×Ö·û´®")º¯Êý:ÏÔʾ"ij×Ö·û´®",²¢µÈ´ýÓû§ÊäÈë.
......
ת×Ô http://hi.baidu.com/xunxun129/blog/item/3befad0f8ff992c07bcbe180.html
ÓÐʱÎÒÃÇÐèÒªÔÚ Python
ÖÐʹÓà zip Îļþ£¬¶øÔÚ1.6°æÖУ¬Python ¾ÍÒѾÌṩÁË zipfile Ä£¿é¿ÉÒÔ½øÐÐÕâÑùµÄ²Ù×÷¡£²»¹ý Python ÖеÄ
zipfile Ä£¿é²»ÄÜ´¦Àí¶à¾íµÄÇé¿ö£¬²»¹ýÕâÖÖÇé¿ö²¢²»¶à¼û£¬Òò´ËÔÚͨ³£Çé¿öÏÂÒѾ×㹻ʹÓÃÁË¡£ÏÂÃæÎÒÖ»Ê ......
php°æ£º
<?php
$cookie_file = fopen('cookie.txt','w');//dirname(__FILE__)."/cookie_".md5(basename(__FILE__)).".txt"; // ÉèÖÃCookieÎļþ±£´æÂ·¾¶¼°ÎļþÃû
function vlogin($url,$data){ // Ä£ÄâµÇ¼»ñÈ¡Cookieº¯Êý
$curl = curl_init(); // Æô¶¯Ò»¸öCURL»á»°
curl_setopt($cur ......
import this
The Zen of Python, by Tim Peters
Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough t ......
PythonÖÐÎļþ²Ù×÷¿ÉÒÔͨ¹ýopenº¯Êý£¬ÕâµÄÈ·ºÜÏñCÓïÑÔÖеÄfopen¡£Í¨¹ýopenº¯Êý»ñȡһ¸öfile object£¬È»ºóµ÷ÓÃread()£¬write()µÈ·½·¨¶ÔÎļþ½øÐжÁд²Ù×÷¡£
1.open
ʹÓÃopen´ò¿ªÎļþºóÒ»¶¨Òª¼ÇµÃµ÷ÓÃÎļþ¶ÔÏóµÄclose()·½·¨¡£±ÈÈç¿ÉÒÔÓÃtry/finallyÓï¾äÀ´È·±£×îºóÄܹرÕÎļþ¡£
file_object = open('thefile.txt' ......