锘??xml version="1.0" encoding="utf-8" standalone="yes"?>日韩影院久久,99热精品久久只有精品,久久亚洲精品无码播放http://www.shnenglu.com/aaxron/category/15298.html璁板綍淇鐨勫嵃璁? zh-cnWed, 23 Dec 2015 03:59:46 GMTWed, 23 Dec 2015 03:59:46 GMT60Python鍜孧ySQL鏃墮棿澶勭悊http://www.shnenglu.com/aaxron/archive/2015/12/23/212542.html澶╀笅澶╀笅Wed, 23 Dec 2015 03:51:00 GMThttp://www.shnenglu.com/aaxron/archive/2015/12/23/212542.htmlhttp://www.shnenglu.com/aaxron/comments/212542.htmlhttp://www.shnenglu.com/aaxron/archive/2015/12/23/212542.html#Feedback0http://www.shnenglu.com/aaxron/comments/commentRss/212542.htmlhttp://www.shnenglu.com/aaxron/services/trackbacks/212542.html#Python
import time
time.strftime("%Y-%m-%d %H:%M:%S",time.localtime(1450842012))


#MySQL
SELECT UNIX_TIMESTAMP(NOW()) as `timestamp`,NOW() as `now`;

澶╀笅 2015-12-23 11:51 鍙戣〃璇勮
]]>
Python涓簩榪涘埗鏁版嵁澶勭悊妯″潡struct浣跨敤http://www.shnenglu.com/aaxron/archive/2013/03/24/198778.html澶╀笅澶╀笅Sun, 24 Mar 2013 10:27:00 GMThttp://www.shnenglu.com/aaxron/archive/2013/03/24/198778.htmlhttp://www.shnenglu.com/aaxron/comments/198778.htmlhttp://www.shnenglu.com/aaxron/archive/2013/03/24/198778.html#Feedback0http://www.shnenglu.com/aaxron/comments/commentRss/198778.htmlhttp://www.shnenglu.com/aaxron/services/trackbacks/198778.htmlPython涓簩榪涘埗鏁版嵁澶勭悊妯″潡struct浣跨敤

Python涓病鏈変簩榪涘埗綾誨瀷錛屼絾鏄彲浠ヤ嬌鐢╯tring瀛楃涓茬被鍨嬫潵瀛樺偍浜岃繘鍒舵暟鎹紝鐒跺悗浣跨敤struct妯″潡鏉ュ浜岃繘鍒舵暟鎹繘琛屽鐞嗐備笅闈㈠皢璇︾粏鎻忚堪濡備綍浣跨敤struct妯″潡鏉ュ鐞嗕簩榪涘埗鏁版嵁銆?br />浣跨敤struct.pack鎶婁竴涓暣鏁板兼墦鍖呮垚瀛楃涓詫紝鎵撳紑Python鍛戒護(hù)琛岋紝杈撳叆錛?br />>>>import struct
>>> a =0x01020304
>>> str= struct.pack("I", a)
>>>repr(str)
"'\\x04\\x03\\x02\\x01'"
姝ゆ椂錛宻tr涓轟竴涓瓧絎︿覆錛屽瓧絎︿覆涓殑鍐呭涓庢暣鏁癮鐨勪簩榪涘埗瀛樺偍鐨勫唴瀹圭浉鍚屻?br />
浣跨敤struct.unpack鎶婂瓧絎︿覆瑙e寘鎴愭暣鏁扮被鍨嬶紝濡備笅錛?br />>>> b =struct.unpack("I", str)
>>> b
(16909060,)
鍦ㄨВ鍖呬箣鍚庯紝榪斿洖涓涓厓緇勭被鍨?tuple)鐨勬暟鎹?br />濡傛灉澶氫釜鏁版嵁榪涜鎵撳寘錛屽彲浠ュ湪鏍煎紡涓寚瀹氭墦鍖呯殑鏁版嵁綾誨瀷錛岀劧鍚庢暟鎹氳繃鍙傛暟浼犲叆錛?br />>>> a ="hello"
>>> b ="world!"
>>> c =2
>>> d =45.123
>>> str= struct.pack("5s6sif", a, b, c, d)
絳変環(huán)浜? struct.pack_into(“5s6sif”,str,  0, a, b, c, d)
>>> str
'helloworld!\x00\x02\x00\x00\x00\xf4}4B'
瑙e寘澶氫釜鏁版嵁鍙互榪欐牱鍋氾細(xì)
>>>parts = struct.unpack("5s6sif", str)
絳変環(huán)浜庯細(xì)  struct.unpack_from(“5s6sif”, str, 0)
>>>parts
('hello','world!', 2, 45.12300109863281)
浠庝笂鍙互鐪嬪埌嫻偣鍊煎湪瑙e寘鍚庝笌鍘熸潵鍊間笉涓鏍鳳紝榪欐槸鍥犱負(fù)嫻偣鏁扮殑綺懼害闂瀵艱嚧鐨勩?br />struct妯″潡涓簩榪涘埗鏍煎紡鍖栬〃紺?br />Format C Type Python type Standard size 
x pad byte no value     
c char string of length 1
b signed char integer 1   
B unsigned char integer 1   
? _Bool bool 1 (1) 
h short integer 2   
H unsigned short integer 2   
i int integer 4   
I unsigned int integer 4   
l long integer 4   
L unsigned long integer 4   
q long long integer 8 (2) 
Q unsigned long long integer 8 (2) 
f float float 4 (3) 
d double float 8 (3) 
s char[] string     
p char[] string     
P void * integer




鏈鍚庝竴涓彲浠ョ敤鏉ヨ〃紺烘寚閽堢被鍨嬶紝鍗?涓瓧鑺傦紙32浣嶏級(jí)錛?涓瓧鑺傦紙64浣嶏級(jí)銆?br />涓轟簡(jiǎn)鍦ㄤ笌涓嶅悓紜歡緇撴瀯涔嬮棿浜ゆ崲鏁版嵁錛岄渶瑕佽冭檻瀛楄妭搴忥紝濡備笅錛?br />瀛楃
瀛楄妭搴?br />澶у皬鍜屽榻?br />@
鏈満瀛楄妭搴?br />鏈満錛屾湰鏈?瀛楄妭瀵歸綈
=
鏈満瀛楄妭搴?br />鏍囧噯錛屾寜鍘熷瓧鑺傛暟瀵歸綈

灝忓熬瀛楄妭搴?br />鏍囧噯錛屾寜鍘熷瓧鑺傛暟瀵歸綈

澶у熬瀛楄妭搴?br />鏍囧噯錛屾寜鍘熷瓧鑺傚榻?br />!
緗戠粶瀛楄妭搴忥紙澶у熬錛?br />鏍囧噯錛屾寜鍘熷瓧鑺傚榻?br />
娉細(xì)緙虹渷鐨勬儏鍐典笅錛屼嬌鐢ㄦ湰鏈哄瓧鑺傚簭錛堝悓@錛夛紝鍙互閫氳繃涓婇潰鐨勫瓧絎︿慨鏀瑰瓧鑺傚簭銆?br />璁$畻鏍煎紡瀛楃涓茬殑澶у皬鍑芥暟錛歴truct.calcsize(fmt)
>>>struct.calcsize("ihi")                       緙虹渷涓?瀛楄妭瀵歸綈鏃訛紝闀垮害涓?2
12
>>>struct.calcsize("iih")                       褰揾鍦ㄦ渶鍚庣殑鏃訛紙姝ゆ椂涓?瀛楄妭瀵歸綈錛夛紝闀垮害涓?0
10
>>>struct.calcsize("@ihi")
12
>>>struct.calcsize("=ihi")
10
>>>struct.calcsize(">ihi")
10
>>>struct.calcsize("<ihi")
10
>>>struct.calcsize("!ihi")
10
娉細(xì)浜岃繘鍒舵枃浠舵墦寮/璇誨彇鐨勬椂鍊欓渶瑕佷嬌鐢?#8220;rb”/“wb”妯″紡浠ヤ簩榪涘埗鏂瑰紡鎵撳紑/璇誨彇鏂囦歡銆?br />娉細(xì)鍏充簬LE(little-endian)鍜孊E錛坆ig-endian錛夊尯鍒細(xì)
LE—鏈絎﹀悎浜虹殑鎬濈淮鐨勫瓧鑺傚簭錛屽湴鍧浣庝綅瀛樺偍鍊肩殑浣庝綅錛屽湴鍧楂樹綅瀛樺偍鍊肩殑楂樹綅銆?br />BE—鏈鐩磋鐨勫瓧鑺傚簭錛屽湴鍧浣庝綅瀛樺偍鍊肩殑楂樹綅錛屽湴鍧楂樹綅瀛樺偍鍊肩殑浣庝綅銆?br />渚嬪錛氬弻瀛?X01020304鍦ㄥ唴瀛樹腑瀛樺偍鏂瑰紡錛孡E=0403 02 01錛孊E=01 02 03 04銆?/div>

澶╀笅 2013-03-24 18:27 鍙戣〃璇勮
]]>
鍔ㄦ佽鍒掔畻娉曪紙4錛夛細(xì)lcs閫掑綊綆楁硶python鐨勫疄鐜?/title><link>http://www.shnenglu.com/aaxron/archive/2013/03/21/198690.html</link><dc:creator>澶╀笅</dc:creator><author>澶╀笅</author><pubDate>Thu, 21 Mar 2013 11:01:00 GMT</pubDate><guid>http://www.shnenglu.com/aaxron/archive/2013/03/21/198690.html</guid><wfw:comment>http://www.shnenglu.com/aaxron/comments/198690.html</wfw:comment><comments>http://www.shnenglu.com/aaxron/archive/2013/03/21/198690.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.shnenglu.com/aaxron/comments/commentRss/198690.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/aaxron/services/trackbacks/198690.html</trackback:ping><description><![CDATA[<div style="border-bottom: #cccccc 1px solid; border-left: #cccccc 1px solid; padding-bottom: 4px; background-color: #eeeeee; padding-left: 4px; width: 98%; padding-right: 5px; font-size: 13px; word-break: break-all; border-top: #cccccc 1px solid; border-right: #cccccc 1px solid; padding-top: 4px"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #008000">#</span><span style="color: #008000">coding:gbk</span><span style="color: #008000"><br /></span><span style="color: #0000ff">import</span><span style="color: #000000"> os,sys<br /></span><span style="color: #0000ff">def</span><span style="color: #000000"> lcs(short, long):<br />    m </span><span style="color: #000000">=</span><span style="color: #000000"> len(short)<br />    n </span><span style="color: #000000">=</span><span style="color: #000000"> len(long)<br />    </span><span style="color: #0000ff">if</span><span style="color: #000000"> (m </span><span style="color: #000000"><=</span><span style="color: #000000"> 0 </span><span style="color: #0000ff">or</span><span style="color: #000000"> n </span><span style="color: #000000"><=</span><span style="color: #000000"> 0):<br />        </span><span style="color: #0000ff">return</span><span style="color: #000000"> </span><span style="color: #800000">""</span><span style="color: #000000">;<br />    </span><span style="color: #0000ff">if</span><span style="color: #000000"> m</span><span style="color: #000000">></span><span style="color: #000000">n:<br />        short,long </span><span style="color: #000000">=</span><span style="color: #000000"> long,short<br /><br />    </span><span style="color: #0000ff">if</span><span style="color: #000000"> short </span><span style="color: #0000ff">in</span><span style="color: #000000"> long:<br />        </span><span style="color: #0000ff">return</span><span style="color: #000000"> short<br />    t1 </span><span style="color: #000000">=</span><span style="color: #000000"> lcs(short[</span><span style="color: #000000">1</span><span style="color: #000000">:],long)<br />    t2 </span><span style="color: #000000">=</span><span style="color: #000000"> lcs(short[0:</span><span style="color: #000000">-</span><span style="color: #000000">1</span><span style="color: #000000">],long)<br />    </span><span style="color: #0000ff">if</span><span style="color: #000000"> t1</span><span style="color: #000000">></span><span style="color: #000000">t2:<br />        </span><span style="color: #0000ff">return</span><span style="color: #000000"> t1<br />    </span><span style="color: #0000ff">else</span><span style="color: #000000">:<br />        </span><span style="color: #0000ff">return</span><span style="color: #000000"> t2<br /><br /><br /></span><span style="color: #0000ff">def</span><span style="color: #000000"> main():<br />    </span><span style="color: #0000ff">if</span><span style="color: #000000"> len(sys.argv)</span><span style="color: #000000"><</span><span style="color: #000000">3</span><span style="color: #000000">:<br />        </span><span style="color: #0000ff">print</span><span style="color: #000000"> </span><span style="color: #800000">"</span><span style="color: #800000">浣跨敤:lcs <瀛楃涓?> <瀛楃涓?></span><span style="color: #800000">"</span><span style="color: #000000"><br />        </span><span style="color: #0000ff">return</span><span style="color: #000000"><br />    a </span><span style="color: #000000">=</span><span style="color: #000000"> lcs(sys.argv[</span><span style="color: #000000">1</span><span style="color: #000000">],sys.argv[</span><span style="color: #000000">2</span><span style="color: #000000">])<br />    </span><span style="color: #0000ff">print</span><span style="color: #000000"> </span><span style="color: #800000">"</span><span style="color: #800000">鏈澶у叕鍏卞瓙涓查暱搴?%d</span><span style="color: #800000">"</span><span style="color: #000000">%</span><span style="color: #000000">len(a)<br />    </span><span style="color: #0000ff">print</span><span style="color: #000000"> </span><span style="color: #800000">"</span><span style="color: #800000">鏈澶у叕鍏卞瓙涓?</span><span style="color: #800000">"</span><span style="color: #000000">+</span><span style="color: #000000">a<br /></span><span style="color: #0000ff">if</span><span style="color: #000000"> </span><span style="color: #800080">__name__</span><span style="color: #000000"> </span><span style="color: #000000">==</span><span style="color: #000000"> </span><span style="color: #800000">'</span><span style="color: #800000">__main__</span><span style="color: #800000">'</span><span style="color: #000000">:<br />    main()<br /><br /></span></div><img src ="http://www.shnenglu.com/aaxron/aggbug/198690.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/aaxron/" target="_blank">澶╀笅</a> 2013-03-21 19:01 <a href="http://www.shnenglu.com/aaxron/archive/2013/03/21/198690.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>python 寮傚父澶勭悊http://www.shnenglu.com/aaxron/archive/2012/08/13/187090.html澶╀笅澶╀笅Mon, 13 Aug 2012 13:20:00 GMThttp://www.shnenglu.com/aaxron/archive/2012/08/13/187090.htmlhttp://www.shnenglu.com/aaxron/comments/187090.htmlhttp://www.shnenglu.com/aaxron/archive/2012/08/13/187090.html#Feedback0http://www.shnenglu.com/aaxron/comments/commentRss/187090.htmlhttp://www.shnenglu.com/aaxron/services/trackbacks/187090.html#coding:gbk
import os,sys,time,ctypes

def main():
    argc 
= len(sys.argv)
    filename 
= r"d:\a.txt"
    
try:
        os.remove(filename)
        
print "鍒犻櫎鏂囦歡鎴愬姛"
    
#except WindowsError as e:     #鍚屼笅涓琛?/span>
    except WindowsError,e:
        
#print ctypes.GetLastError()
        #print os.strerror(e.errno)
        if e.errno==2:
            
print "鏂囦歡涓嶅瓨鍦?/span>"
    
finally:
        
pass

if __name__ == '__main__':
    main()

#鏌ョ湅閿欒鍙鳳細(xì)http://msdn.microsoft.com/en-us/library/windows/desktop/ms681382(v=vs.85).aspx

澶╀笅 2012-08-13 21:20 鍙戣〃璇勮
]]>
python mysql灝佽http://www.shnenglu.com/aaxron/archive/2012/08/06/186472.html澶╀笅澶╀笅Mon, 06 Aug 2012 08:38:00 GMThttp://www.shnenglu.com/aaxron/archive/2012/08/06/186472.htmlhttp://www.shnenglu.com/aaxron/comments/186472.htmlhttp://www.shnenglu.com/aaxron/archive/2012/08/06/186472.html#Feedback0http://www.shnenglu.com/aaxron/comments/commentRss/186472.htmlhttp://www.shnenglu.com/aaxron/services/trackbacks/186472.html#coding:utf-8
#
08騫村啓鐨?/span>
import sys
try:
    
import MySQLdb
except ImportError:
    sys.exit(
"Exceptions.ImportError: No module named MySQLdb\n");

class pymysql(object):
    conn   
= None

    
def __init__(self):
        
pass

    
def __del__(self):
        self.close()

    
def connect(self,db_host,db_user,db_password,db_name,db_port=3306,db_charset='utf8'):
        
try:
            self.conn 
= MySQLdb.connect(host=db_host,user=db_user,passwd=db_password,db=db_name,port=db_port,charset=db_charset)

            self.
__db_host = db_host
            self.
__db_user = db_user
            self.
__db_password = db_password
            self.
__db_name = db_name
            self.
__db_port = db_port
            self.
__db_charset = db_charset
            
return True
        
except:
            
return False


    
def reconnect(self):
        
try:
            self.conn 
= MySQLdb.connect(host=self.__db_host,user=self.__db_user,passwd=self.__db_password,db=self.__db_name,port=self.__db_port,charset=self.__db_charset)
            
return True
        
except:
            
return False
    
def quote(self,queryString):
        
return MySQLdb.escape_string(queryString);

    
def query(self,sql):
        
try:
            cursor 
= self.conn.cursor()
            cursor.execute(sql)
            
return cursor
        
except:
            sys.exit(
"MySQL Query Error:\n"+sql+"\n")


    
def execute(self,sql):
        
try:
            
return self.conn.cursor().execute(sql)
        
except:
            sys.exit(
"MySQL Query Error:\n"+sql+"\n")

    
def fetch(self,cursor):
        
return cursor.fetchone()

    
def fetchRow(self,sql):
        
return self.query(sql).fetchone()

    
def fetchOne(self,sql):
        
try:
            
return self.query(sql).fetchone()[0]
        
except:
            
return None

    
def fetchAll(self,sql):
        
return self.query(sql).fetchall()

    
def insert(self,table,row):
        sqlArr 
= []
        
for key in row.iterkeys():
            sqlArr.append(
"%s='%s'"%(key,row[key],))
        sql 
= "insert into "+table +" set "+str.join(",",sqlArr)
        
return self.execute(sql)


    
def update(self,table,row,where):
        sqlArr 
= []
        
for key in row.iterkeys():
            sqlArr.append(
"%s='%s'"%(key,row[key],))
        sql 
= "update "+table +" set "+str.join(",",sqlArr)+" where "+where
        
return self.execute(sql)

    
def close(self):
        
if self.conn:
            self.conn.close()


澶╀笅 2012-08-06 16:38 鍙戣〃璇勮
]]>
鍏充簬鎵瑰鐞嗛噸瀹氬悜http://www.shnenglu.com/aaxron/archive/2012/08/01/185854.html澶╀笅澶╀笅Wed, 01 Aug 2012 02:24:00 GMThttp://www.shnenglu.com/aaxron/archive/2012/08/01/185854.htmlhttp://www.shnenglu.com/aaxron/comments/185854.htmlhttp://www.shnenglu.com/aaxron/archive/2012/08/01/185854.html#Feedback0http://www.shnenglu.com/aaxron/comments/commentRss/185854.htmlhttp://www.shnenglu.com/aaxron/services/trackbacks/185854.html鍏充簬鎵瑰鐞嗛噸瀹氬悜 

閲嶅畾鍚戠鍙鋒湁 
< 銆?/span>> 銆?/span>>> 銆?/span><& 銆?/span>>& 鍜?nbsp;| 鍏卞叚涓?br />
閲嶅畾鍚戠鍙風(fēng)殑浣滅敤濡備笅琛ㄦ墍紺猴細(xì)

絎﹀彿銆銆銆浣滅敤
——————————————————————————————
<銆銆銆浠庢枃浠舵垨璁懼錛堝榛樿鐨?nbsp;con 閿洏錛変腑璇誨彇鍛戒護(hù)杈撳叆銆?br />>銆銆銆灝嗗懡浠よ緭鍑哄啓鍏ュ埌鏂囦歡鎴栬澶囷紙濡?nbsp;prn 鎵撳嵃鏈猴級(jí)涓?nbsp;
>>銆銆 灝嗗懡浠よ緭鍑烘坊鍔犲埌鏂囦歡鏈熬鑰屼笉鍒犻櫎鏂囦歡涓殑淇℃伅銆?br /><&銆銆浠庡悗涓涓彞鏌勮鍙栬緭鍏ュ茍鍐欏叆鍒板墠涓涓彞鏌勮緭鍑轟腑銆?br />>&銆銆灝嗗墠涓涓彞鏌勭殑杈撳嚭鍐欐垚鍚庝竴涓彞鏌勭殑杈撳叆銆?br />|銆銆銆璇誨彇鍓嶄竴涓懡浠や腑鐨勮緭鍑轟綔涓哄悗涓涓懡浠ょ殑杈撳叆銆備篃縐頒綔綆¢亾絎︺?br />——————————————————————————————
娉ㄦ剰錛氬彞鏌勭殑杈撳叆杈撳嚭鍙槸鍏舵寚鍚戯紝鐪熸鐨勮緭鍏ヨ緭鍑烘槸闈犺澶囥?br />閲嶅畾鍚戠鍙風(fēng)殑榛樿鍙ユ焺錛?/span>< 鐨勯粯璁ゅ彞鏌勬槸 0錛?/span>> 鐨勯粯璁ゅ彞鏌勬槸 1銆?br />
鍙敤鍙ユ焺錛?/span>0 - 9錛夊涓嬭〃錛?br />
鍙ユ焺銆銆銆銆鍙ユ焺鍙楓銆銆璇存槑
——————————————————————————————
STDIN銆銆銆銆
0銆銆銆銆 鏍囧噯杈撳叆錛岄粯璁や粠閿洏杈撳叆
STDOUT銆銆銆 
1銆銆銆銆鏍囧噯杈撳嚭錛岄粯璁よ緭鍑哄埌鍛戒護(hù)鎻愮ず絎︾獥鍙?br />STDERR銆銆銆 2 銆銆銆   鏍囧噯閿欒杈撳嚭錛岄粯璁よ緭鍑哄埌鍛戒護(hù)鎻愮ず絎︾獥鍙?br />UNDEFINED銆  3-9銆銆銆  榪欎簺鍙ユ焺鐢卞簲鐢ㄧ▼搴忓拰鍚勪釜鍏蜂綋宸ュ叿鍗曠嫭瀹氫箟銆?br />——————————————————————————————

璁懼
絀鴻澶囷紝鐢?nbsp;nul 琛ㄧず銆?br />瀛樺偍璁懼錛屾枃浠跺氨褰掑埌榪欑被銆?br />涓嶅父鐢ㄧ殑濡傦細(xì)鎵撳嵃鏈?nbsp;prn銆?br />
錛堝師鏂囧湴鍧錛歨ttp:
//bbs.bathome.net/viewthread.php?tid=2579錛?/span>


浣滀竴鐐硅ˉ鍏咃細(xì)騫蟲椂鐢ㄥ埌鏈澶氱殑搴旇灝辨槸 
> nul 浜?jiǎn)锛屽畠鍙槸绠鍖栫殑閲嶅畾鍚戞爣鍑嗚緭鍑?nbsp;1> nul 鐨勫啓娉曪紝涓庢綾諱技錛?nbsp;2> 灝辨槸閲嶅畾鍚戞爣鍑嗛敊璇緭鍑恒?br />

import os,time
cmd 
= r'net use X: \\192.168.3.166\xuxinhua 2>nul'
while (True):
    print cmd
    nRet 
= os.system(cmd)
    
if (nRet==0):
        print r
'run cmd success,after 5(s) exit!'
        time.sleep(
5)
        exit()
    time.sleep(
5)
   


澶╀笅 2012-08-01 10:24 鍙戣〃璇勮
]]>
python婧愮爜鐗囨http://www.shnenglu.com/aaxron/archive/2012/01/16/164238.html澶╀笅澶╀笅Mon, 16 Jan 2012 02:52:00 GMThttp://www.shnenglu.com/aaxron/archive/2012/01/16/164238.htmlhttp://www.shnenglu.com/aaxron/comments/164238.htmlhttp://www.shnenglu.com/aaxron/archive/2012/01/16/164238.html#Feedback0http://www.shnenglu.com/aaxron/comments/commentRss/164238.htmlhttp://www.shnenglu.com/aaxron/services/trackbacks/164238.htmltp_obj tp_printf(tp_vm *tp, char const *fmt,
{
    
int l;
    tp_obj r;
    
char *s;
    va_list arg;
    va_start(arg, fmt);
    l 
= vsnprintf(NULL, 0, fmt,arg);
    r 
= tp_string_t(tp,l);
    s 
= r.string.info->s;
    va_end(arg);
    va_start(arg, fmt);
    vsprintf(s,fmt,arg);
    va_end(arg);
    
return tp_track(tp,r);
}


澶╀笅 2012-01-16 10:52 鍙戣〃璇勮
]]>
涓篞T緙栬瘧鍐欑殑py鑴氭湰http://www.shnenglu.com/aaxron/archive/2011/09/22/156514.html澶╀笅澶╀笅Thu, 22 Sep 2011 02:26:00 GMThttp://www.shnenglu.com/aaxron/archive/2011/09/22/156514.htmlhttp://www.shnenglu.com/aaxron/comments/156514.htmlhttp://www.shnenglu.com/aaxron/archive/2011/09/22/156514.html#Feedback0http://www.shnenglu.com/aaxron/comments/commentRss/156514.htmlhttp://www.shnenglu.com/aaxron/services/trackbacks/156514.html#!/usr/bin/python
#
coding:utf-8
import os,sys,string

argc 
= len(sys.argv)
nResult 
= 0

dirname 
= os.path.basename(os.getcwd())
proj
= dirname + ".pro"
file_exe 
= dirname


if argc==2:
    para
=sys.argv[1]
    
if para == "--help" or para=="-h":
        sys.exit(
"Usage:mk [rebuild|clean]")
    
if para=="clean":
        cmd
="make clean 2>/dev/null"
        
print cmd
        os.system(cmd)
        cmd
="rm -f Makefile"
        
print cmd
        os.system(cmd)
        cmd
="rm -f "+proj
        
print cmd
        os.system(cmd)
        cmd 
= "rm -f " + file_exe
        
print cmd
        os.system(cmd)
        sys.exit(
"mk clean completed!")
    
if para== "rebuild":
        cmd 
= "mk clean"
        
print cmd
        os.system(cmd)
        cmd 
= "mk"
        
print cmd
        os.system(cmd)
        sys.exit()

if not os.path.isfile(proj):
    cmd 
= "qmake -project"
    
print cmd
    os.system(cmd)

cmd 
= "qmake "+proj
print cmd
os.system(cmd)

cmd
="make"
print cmd
nResult 
= os.system(cmd)

print("\n---------------")
if nResult==0:
    
print("build Success")
else:
    
print("build Failure")


澶╀笅 2011-09-22 10:26 鍙戣〃璇勮
]]>
python灝忓嚱鏁?/title><link>http://www.shnenglu.com/aaxron/archive/2011/09/21/156395.html</link><dc:creator>澶╀笅</dc:creator><author>澶╀笅</author><pubDate>Wed, 21 Sep 2011 02:49:00 GMT</pubDate><guid>http://www.shnenglu.com/aaxron/archive/2011/09/21/156395.html</guid><wfw:comment>http://www.shnenglu.com/aaxron/comments/156395.html</wfw:comment><comments>http://www.shnenglu.com/aaxron/archive/2011/09/21/156395.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/aaxron/comments/commentRss/156395.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/aaxron/services/trackbacks/156395.html</trackback:ping><description><![CDATA[<div style="border-bottom: #cccccc 1px solid; border-left: #cccccc 1px solid; padding-bottom: 4px; background-color: #eeeeee; padding-left: 4px; width: 98%; padding-right: 5px; font-size: 13px; word-break: break-all; border-top: #cccccc 1px solid; border-right: #cccccc 1px solid; padding-top: 4px"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #008000">#</span><span style="color: #008000">coding:gbk</span><span style="color: #008000"><br /></span><span style="color: #000000"><br /></span><span style="color: #0000ff">import</span><span style="color: #000000"> os,sys,time<br /><br /></span><span style="color: #0000ff">def</span><span style="color: #000000"> get_ext(fileName):<br />    pos </span><span style="color: #000000">=</span><span style="color: #000000"> fileName.rfind(</span><span style="color: #800000">"</span><span style="color: #800000">.</span><span style="color: #800000">"</span><span style="color: #000000">)<br />    </span><span style="color: #0000ff">if</span><span style="color: #000000"> pos </span><span style="color: #000000">!=-</span><span style="color: #000000">1</span><span style="color: #000000">:<br />        </span><span style="color: #0000ff">return</span><span style="color: #000000"> fileName[pos:].lower()<br />    </span><span style="color: #0000ff">else</span><span style="color: #000000">:<br />        </span><span style="color: #0000ff">return</span><span style="color: #000000"> None<br /><br /></span><span style="color: #0000ff">def</span><span style="color: #000000"> str2int(v):<br />    </span><span style="color: #0000ff">try</span><span style="color: #000000">:v </span><span style="color: #000000">=</span><span style="color: #000000"> int(v)<br />    </span><span style="color: #0000ff">except</span><span style="color: #000000">:v </span><span style="color: #000000">=</span><span style="color: #000000"> 0<br />    </span><span style="color: #0000ff">return</span><span style="color: #000000"> v<br /><br /></span><span style="color: #0000ff">def</span><span style="color: #000000"> mod(x,y):<br />    </span><span style="color: #0000ff">return</span><span style="color: #000000"> float(x)</span><span style="color: #000000">/</span><span style="color: #000000">y<br /><br /></span><span style="color: #0000ff">def</span><span style="color: #000000"> printf(format,</span><span style="color: #000000">*</span><span style="color: #000000">args):<br />    sys.stdout.write(format</span><span style="color: #000000">%</span><span style="color: #000000">args)<br /><br /></span><span style="color: #0000ff">def</span><span style="color: #000000"> sprintf(format,</span><span style="color: #000000">*</span><span style="color: #000000">args):<br />    </span><span style="color: #0000ff">return</span><span style="color: #000000"> format</span><span style="color: #000000">%</span><span style="color: #000000">args<br /><br /></span><span style="color: #0000ff">def</span><span style="color: #000000"> exit_delay(num):<br />    secnod </span><span style="color: #000000">=</span><span style="color: #000000"> num<br />    text </span><span style="color: #000000">=</span><span style="color: #000000"> r</span><span style="color: #800000">"</span><span style="color: #800000">after (%02d) secnod exit.</span><span style="color: #800000">"</span><span style="color: #000000"><br />    length </span><span style="color: #000000">=</span><span style="color: #000000"> len(text)</span><span style="color: #000000">-</span><span style="color: #000000">2</span><span style="color: #000000"><br />    back </span><span style="color: #000000">=</span><span style="color: #000000"> </span><span style="color: #800000">""</span><span style="color: #000000"><br />    </span><span style="color: #0000ff">for</span><span style="color: #000000"> i </span><span style="color: #0000ff">in</span><span style="color: #000000"> range(length):<br />        back </span><span style="color: #000000">=</span><span style="color: #000000"> back </span><span style="color: #000000">+</span><span style="color: #000000"> </span><span style="color: #800000">"</span><span style="color: #800000">\b</span><span style="color: #800000">"</span><span style="color: #000000"><br />    </span><span style="color: #0000ff">while</span><span style="color: #000000"> (secnod):<br />        sys.stdout.write(text</span><span style="color: #000000">%</span><span style="color: #000000">secnod)<br />        sys.stdout.flush()<br />        time.sleep(</span><span style="color: #000000">1</span><span style="color: #000000">)<br />        sys.stdout.write(back)<br />        secnod </span><span style="color: #000000">=</span><span style="color: #000000"> secnod </span><span style="color: #000000">-</span><span style="color: #000000">1</span><span style="color: #000000">;<br />    sys.stdout.write(text</span><span style="color: #000000">%</span><span style="color: #000000">secnod)<br />    sys.stdout.write(</span><span style="color: #800000">"</span><span style="color: #800000">\r\n</span><span style="color: #800000">"</span><span style="color: #000000">)<br />    <br /></span><span style="color: #0000ff">def</span><span style="color: #000000"> unlink(filename):<br />    </span><span style="color: #0000ff">try</span><span style="color: #000000">:<br />        os.remove(filename)<br />        printf(</span><span style="color: #800000">"</span><span style="color: #800000">鍒犻櫎鏂囦歡(%s)鎴愬姛 \r\n</span><span style="color: #800000">"</span><span style="color: #000000">,filename)<br />    </span><span style="color: #0000ff">except</span><span style="color: #000000"> WindowsError,e:<br />        </span><span style="color: #0000ff">if</span><span style="color: #000000"> e.errno</span><span style="color: #000000">==</span><span style="color: #000000">2</span><span style="color: #000000">:<br />            printf(</span><span style="color: #800000">"</span><span style="color: #800000">鏂囦歡(%s)涓嶅瓨鍦?nbsp;\r\n</span><span style="color: #800000">"</span><span style="color: #000000">,filename)<br />            <br /></span><span style="color: #0000ff">def</span><span style="color: #000000"> A(n):<br />    c </span><span style="color: #000000">=</span><span style="color: #000000"> </span><span style="color: #000000">1</span><span style="color: #000000"><br />    </span><span style="color: #0000ff">for</span><span style="color: #000000"> i </span><span style="color: #0000ff">in</span><span style="color: #000000"> range(n):<br />        c </span><span style="color: #000000">*=</span><span style="color: #000000"> i</span><span style="color: #000000">+</span><span style="color: #000000">1</span><span style="color: #000000"><br />    </span><span style="color: #0000ff">return</span><span style="color: #000000"> c<br /><br /></span><span style="color: #0000ff">def</span><span style="color: #000000"> C(n,m):<br />    </span><span style="color: #0000ff">return</span><span style="color: #000000"> A(n)</span><span style="color: #000000">/</span><span style="color: #000000">A(n</span><span style="color: #000000">-</span><span style="color: #000000">m)</span><span style="color: #000000">/</span><span style="color: #000000">A(m)            <br /></span></div><img src ="http://www.shnenglu.com/aaxron/aggbug/156395.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/aaxron/" target="_blank">澶╀笅</a> 2011-09-21 10:49 <a href="http://www.shnenglu.com/aaxron/archive/2011/09/21/156395.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>python 鏃墮棿浣跨敤http://www.shnenglu.com/aaxron/archive/2011/03/07/141257.html澶╀笅澶╀笅Mon, 07 Mar 2011 03:22:00 GMThttp://www.shnenglu.com/aaxron/archive/2011/03/07/141257.htmlhttp://www.shnenglu.com/aaxron/comments/141257.htmlhttp://www.shnenglu.com/aaxron/archive/2011/03/07/141257.html#Feedback0http://www.shnenglu.com/aaxron/comments/commentRss/141257.htmlhttp://www.shnenglu.com/aaxron/services/trackbacks/141257.htmlpython 鏃墮棿浣跨敤
#鑾峰彇褰撳墠鏃墮棿
import time
now 
= time.time()
time.localtime()
(
200762124775153, 0)
localtime榪斿洖tuple鏍煎紡鐨勬椂闂?br>gmtime()榪斿洖鐨勬槸0鏃跺尯鐨勫鹼紝
localtime榪斿洖鐨勬槸褰撳墠鏃跺尯鐨勫箋?br>
#鏌ョ湅鏃跺尯鐢?/span>
>>> time.timezone
-28800
涓婇潰鐨勫兼槸涓涓鍊鹼紝鏄綋鍓嶆椂鍖哄拰0鏃跺尯鐩稿樊鐨勬弿榪幫紝
-28800=-8*3600錛屽嵆涓轟笢鍏尯銆?br>


time.strftime( 
"%Y-%m-%d %H:%M:%S", time.localtime( time.time() ) )

鍐嶆妸鏍煎紡璁板綍濡備笅

%a 鏄熸湡鍑犵殑綆鍐?nbsp;Weekday name, abbr.
%A 鏄熸湡鍑犵殑鍏ㄧО Weekday name, full
%b 鏈堝垎鐨勭畝鍐?nbsp;Month name, abbr.
%B 鏈堜喚鐨勫叏縐?nbsp;Month name, full
%c 鏍囧噯鐨勬棩鏈熺殑鏃墮棿涓?nbsp;Complete date and time representation
%d 鍗佽繘鍒惰〃紺虹殑姣忔湀鐨勭鍑犲ぉ Day of the month
%H 24灝忔椂鍒剁殑灝忔椂 Hour (24-hour clock)
%I 12灝忔椂鍒剁殑灝忔椂 Hour (12-hour clock)
%j 鍗佽繘鍒惰〃紺虹殑姣忓勾鐨勭鍑犲ぉ Day of the year
%m 鍗佽繘鍒惰〃紺虹殑鏈堜喚 Month number
%M 鍗佹椂鍒惰〃紺虹殑鍒嗛挓鏁?nbsp;Minute number
%S 鍗佽繘鍒剁殑縐掓暟 Second number
%U 絎勾鐨勭鍑犲懆錛屾妸鏄熸湡鏃ュ仛涓虹涓澶╋紙鍊間粠0鍒?3錛塛eek number (Sunday first weekday)
%w 鍗佽繘鍒惰〃紺虹殑鏄熸湡鍑狅紙鍊間粠0鍒?錛屾槦鏈熷ぉ涓?錛墂eekday number
%W 姣忓勾鐨勭鍑犲懆錛屾妸鏄熸湡涓鍋氫負(fù)絎竴澶╋紙鍊間粠0鍒?3錛?nbsp;Week number (Monday first weekday)
%x 鏍囧噯鐨勬棩鏈熶覆 Complete date representation (e.g. 13/01/08)
%X 鏍囧噯鐨勬椂闂翠覆 Complete time representation (e.g. 17:02:10)
%y 涓嶅甫涓栫邯鐨勫崄榪涘埗騫翠喚錛堝間粠0鍒?9錛塝ear number within century
%Y 甯︿笘綰儴鍒嗙殑鍗佸埗騫翠喚 Year number
%z錛?/span>%Z 鏃跺尯鍚嶇О錛屽鏋滀笉鑳藉緱鍒版椂鍖哄悕縐板垯榪斿洖絀哄瓧絎︺侼ame of time zone
%% 鐧懼垎鍙?br>


澶╀笅 2011-03-07 11:22 鍙戣〃璇勮
]]>
[鍘熷垱]Python 鍚勮繘鍒墮棿鐨勮漿鎹?/title><link>http://www.shnenglu.com/aaxron/archive/2011/02/28/140785.html</link><dc:creator>澶╀笅</dc:creator><author>澶╀笅</author><pubDate>Mon, 28 Feb 2011 05:03:00 GMT</pubDate><guid>http://www.shnenglu.com/aaxron/archive/2011/02/28/140785.html</guid><wfw:comment>http://www.shnenglu.com/aaxron/comments/140785.html</wfw:comment><comments>http://www.shnenglu.com/aaxron/archive/2011/02/28/140785.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/aaxron/comments/commentRss/140785.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/aaxron/services/trackbacks/140785.html</trackback:ping><description><![CDATA[<p>鏈榪戝湪鍋氬崗璁垎鏋愭椂緇忓父瑕佺敤浜涜繘鍒墮棿鐨勮漿鎹㈠嚱鏁?<br>璁板綍瀛樻。:</p> <div style="BORDER-BOTTOM: #cccccc 1px solid; BORDER-LEFT: #cccccc 1px solid; PADDING-BOTTOM: 4px; BACKGROUND-COLOR: #eeeeee; PADDING-LEFT: 4px; WIDTH: 98%; PADDING-RIGHT: 5px; FONT-FAMILY: Verdana; FONT-SIZE: 13px; WORD-BREAK: break-all; BORDER-TOP: #cccccc 1px solid; BORDER-RIGHT: #cccccc 1px solid; PADDING-TOP: 4px"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif"><span style="COLOR: #008000">#</span><span style="COLOR: #008000">python 2.6浠ュ悗鍐呯疆鍑芥暟</span><span style="COLOR: #008000"><br><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #000000"><br><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #008000">#</span><span style="COLOR: #008000">10榪涘埗杞負(fù)2榪涘埗</span><span style="COLOR: #008000"><br><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #000000">>>></span><span style="COLOR: #000000"> bin(</span><span style="COLOR: #000000">10</span><span style="COLOR: #000000">)<br><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #800000">'</span><span style="COLOR: #800000">0b1010</span><span style="COLOR: #800000">'</span><span style="COLOR: #000000"><br><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif"><br><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #008000">#</span><span style="COLOR: #008000">2榪涘埗杞負(fù)10榪涘埗</span><span style="COLOR: #008000"><br><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #000000">>>></span><span style="COLOR: #000000"> int(</span><span style="COLOR: #800000">"</span><span style="COLOR: #800000">1001</span><span style="COLOR: #800000">"</span><span style="COLOR: #000000">,</span><span style="COLOR: #000000">2</span><span style="COLOR: #000000">)<br><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #000000">9</span><span style="COLOR: #000000"><br><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif"><br><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif"><br><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #008000">#</span><span style="COLOR: #008000">10榪涘埗杞負(fù)16榪涘埗</span><span style="COLOR: #008000"><br><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #000000">>>></span><span style="COLOR: #000000"> hex(</span><span style="COLOR: #000000">10</span><span style="COLOR: #000000">)<br><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #800000">'</span><span style="COLOR: #800000">0xa</span><span style="COLOR: #800000">'</span><span style="COLOR: #000000"><br><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif"><br><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #008000">#</span><span style="COLOR: #008000">16榪涘埗鍒?0榪涘埗</span><span style="COLOR: #008000"><br><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #000000">>>></span><span style="COLOR: #000000"> int(</span><span style="COLOR: #800000">'</span><span style="COLOR: #800000">ff</span><span style="COLOR: #800000">'</span><span style="COLOR: #000000">, </span><span style="COLOR: #000000">16</span><span style="COLOR: #000000">)<br><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #000000">255</span><span style="COLOR: #000000"><br><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif"><br><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #000000">>>></span><span style="COLOR: #000000"> int(</span><span style="COLOR: #800000">'</span><span style="COLOR: #800000">0xab</span><span style="COLOR: #800000">'</span><span style="COLOR: #000000">, </span><span style="COLOR: #000000">16</span><span style="COLOR: #000000">)<br><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #000000">171</span><span style="COLOR: #000000"><br><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif"><br><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #008000">#</span><span style="COLOR: #008000">鍗佽繘鍒惰漿涓哄叓榪涘埗</span><span style="COLOR: #008000"><br><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #000000">>></span><span style="COLOR: #0000ff">print</span><span style="COLOR: #000000">(</span><span style="COLOR: #800000">"</span><span style="COLOR: #800000">%o</span><span style="COLOR: #800000">"</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">%</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">10</span><span style="COLOR: #000000">)<br><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #000000">>></span><span style="COLOR: #000000">12</span><span style="COLOR: #000000"><br><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif"><br><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif"><br><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #008000">#</span><span style="COLOR: #008000">16榪涘埗鍒?榪涘埗</span><span style="COLOR: #008000"><br><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #000000">>>></span><span style="COLOR: #000000"> bin(</span><span style="COLOR: #000000">0xa</span><span style="COLOR: #000000">)<br><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #800000">'</span><span style="COLOR: #800000">0b1010</span><span style="COLOR: #800000">'</span><span style="COLOR: #000000"><br><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #000000">>>></span><span style="COLOR: #000000"><br><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif"></span></div> <br> <div style="BORDER-BOTTOM: #cccccc 1px solid; BORDER-LEFT: #cccccc 1px solid; PADDING-BOTTOM: 4px; BACKGROUND-COLOR: #eeeeee; PADDING-LEFT: 4px; WIDTH: 98%; PADDING-RIGHT: 5px; FONT-SIZE: 13px; WORD-BREAK: break-all; BORDER-TOP: #cccccc 1px solid; BORDER-RIGHT: #cccccc 1px solid; PADDING-TOP: 4px"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif"><span style="COLOR: #000000"><br><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #008000">#</span><span style="COLOR: #008000">10榪涘埗鍒?榪涘埗</span><span style="COLOR: #008000"><br><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #000000">>>></span><span style="COLOR: #000000"> oct(</span><span style="COLOR: #000000">8</span><span style="COLOR: #000000">)<br><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #800000">'</span><span style="COLOR: #800000">010</span><span style="COLOR: #800000">'</span><span style="COLOR: #000000"> <br><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif"><br><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #008000">#</span><span style="COLOR: #008000">2榪涘埗鍒?6榪涘埗</span><span style="COLOR: #008000"><br><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #000000">>>></span><span style="COLOR: #000000"> hex(0b1001)<br><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #800000">'</span><span style="COLOR: #800000">0x9</span><span style="COLOR: #800000">'</span></div> <br> <div style="BORDER-BOTTOM: #cccccc 1px solid; BORDER-LEFT: #cccccc 1px solid; PADDING-BOTTOM: 4px; BACKGROUND-COLOR: #eeeeee; PADDING-LEFT: 4px; WIDTH: 98%; PADDING-RIGHT: 5px; FONT-SIZE: 13px; WORD-BREAK: break-all; BORDER-TOP: #cccccc 1px solid; BORDER-RIGHT: #cccccc 1px solid; PADDING-TOP: 4px"><span style="COLOR: #008000">#</span><span style="COLOR: #008000">IP鍦板潃涔嬮棿鐨勮漿鎹?/span><span style="COLOR: #008000"><br></span><span style="COLOR: #0000ff">import</span><span style="COLOR: #000000"> <span style="COLOR: #ff0000">socket</span><br></span><span style="COLOR: #0000ff">import <span style="COLOR: #ff0000">time</span><br>import</span><span style="COLOR: #000000"> <span style="COLOR: #ff0000">struct<br></span><br></span><span style="COLOR: #0000ff">def</span><span style="COLOR: #000000"> ip2hex (ip):<br>    </span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000"> hex(struct.unpack(</span><span style="COLOR: #800000">"</span><span style="COLOR: #800000">!I</span><span style="COLOR: #800000">"</span><span style="COLOR: #000000">, socket.inet_aton(ip))[0])<br>    <br></span><span style="COLOR: #0000ff">def</span><span style="COLOR: #000000"> ip2long (ip):<br>    </span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000"> <span style="COLOR: #ff0000">struct</span>.unpack(</span><span style="COLOR: #800000">"</span><span style="COLOR: #800000">!I</span><span style="COLOR: #800000">"</span><span style="COLOR: #000000">, socket.inet_aton(ip))[0]    <br><br></span><span style="COLOR: #0000ff">def</span><span style="COLOR: #000000"> long2ip (lint):<br>    </span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000"> <span style="COLOR: #ff0000">socket</span>.inet_ntoa(struct.pack(</span><span style="COLOR: #800000">"</span><span style="COLOR: #800000">!I</span><span style="COLOR: #800000">"</span><span style="COLOR: #000000">, lint))<br><br><span style="COLOR: #008000">#</span><span style="COLOR: #008000">鏃墮棿鎴蟲牸寮忓寲</span><br><span style="COLOR: #0000ff">def</span> l2t (lint):<br>    <span style="COLOR: #0000ff">return</span> <span style="COLOR: #ff0000">time</span>.strftime(<span style="COLOR: #800000">"%Y-%m-%d %H:%M:%S"</span>,time.localtime(lint))<br></span></div> <img src ="http://www.shnenglu.com/aaxron/aggbug/140785.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/aaxron/" target="_blank">澶╀笅</a> 2011-02-28 13:03 <a href="http://www.shnenglu.com/aaxron/archive/2011/02/28/140785.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>Linux usermod -p 淇敼鐢ㄦ埛瀵嗙爜http://www.shnenglu.com/aaxron/archive/2010/12/02/135251.html澶╀笅澶╀笅Thu, 02 Dec 2010 03:07:00 GMThttp://www.shnenglu.com/aaxron/archive/2010/12/02/135251.htmlhttp://www.shnenglu.com/aaxron/comments/135251.htmlhttp://www.shnenglu.com/aaxron/archive/2010/12/02/135251.html#Feedback0http://www.shnenglu.com/aaxron/comments/commentRss/135251.htmlhttp://www.shnenglu.com/aaxron/services/trackbacks/135251.htmlLinux usermod -p 淇敼鐢ㄦ埛瀵嗙爜

passwd涔熷彲浠ヤ慨鏀瑰彛浠わ紝浣嗘槸榪欐槸涓縐嶄氦浜掑紡鐨勬柟寮忥紝闇瑕佺敤鎴峰共棰勩傚綋鐒朵篃鍙互浣跨敤閲嶅畾鍚戞垨鑰呯閬撳悜passwd鍠傛暟鎹紝鏆備笖涓嶆彁銆?br>
linux涓嬪鍔犵敤鎴風(fēng)殑鍛戒護(hù)鏄痷seradd錛屼慨鏀圭敤鎴風(fēng)殑鍛戒護(hù)鏄痷sermod錛屼簩鑰呴兘鏈変竴涓弬鏁?nbsp;–p錛岃繖涓弬鏁板彲浠ョ洿鎺ユ寚瀹氱敤鎴風(fēng)殑鍙d護(hù)錛屼絾鏄渶瑕佹敞鎰忕殑鏄紝榪欎釜鍙d護(hù)騫朵笉鏄槑鏂囷紝鑰屾槸緇忚繃鍔犲瘑鐨勪竴涓瓧涓層?br>
linux涓嬪彲浠ョ敤python緙栬緫鍣ㄩ氳繃緙栫▼鐨勬柟娉曞緱鍒板姞瀵嗗瓧涓詫紙linux涓嬬敤python鍛戒護(hù)鍚姩緙栬緫鍣級(jí)錛?br>
涓嬮潰鏄竴涓畬鏁寸殑榪囩▼錛岃摑鑹插瓧浣撶殑鏄敤鎴瘋緭鍏ョ殑鍛戒護(hù)錛岃岀孩鑹茬殑鏄郴緇熻緭鍑恒?br>
============================================

[root@linux 
~]# python

Python 
2.3.4 (#1, Oct 26 2004, 16:42:40) 

[GCC 
3.4.2 20041017 (Red Hat 3.4.2-6.fc3)] on linux2

Type 
"help""copyright""credits" or "license" for more information.

>>> import crypt;print(crypt.crypt("your password","ab"));

ab62Jfo2yjBEo

>>> 

============================================

涓婇潰鐢ㄦ埛杈撳叆淇℃伅涓殑“your password”鍙互鏇挎崲涓洪渶瑕佸姞瀵嗙殑鍙d護(hù)錛?#8220;ab”鍙浛鎹負(fù)浠繪剰鐨勪袱涓ぇ灝忓啓瀛楃鎴栬呮暟瀛楋紝鑰?#8220;ab62Jfo2yjBEo”灝辨槸鍔犲瘑鍚庣殑瀵嗘枃銆?br>

涓涓畝鍗曠殑渚嬪瓙濡備笅錛?br>
useradd –p ab62Jfo2yjBEo testuser

usermod –p ab62Jfo2yjBEo testuser 
 



澶╀笅 2010-12-02 11:07 鍙戣〃璇勮
]]>
闈炵函VC/C++/python瓚呯駭緹?88028655 ,嬈㈣繋鍔犲叆.http://www.shnenglu.com/aaxron/archive/2010/10/28/131633.html澶╀笅澶╀笅Thu, 28 Oct 2010 07:21:00 GMThttp://www.shnenglu.com/aaxron/archive/2010/10/28/131633.htmlhttp://www.shnenglu.com/aaxron/comments/131633.htmlhttp://www.shnenglu.com/aaxron/archive/2010/10/28/131633.html#Feedback0http://www.shnenglu.com/aaxron/comments/commentRss/131633.htmlhttp://www.shnenglu.com/aaxron/services/trackbacks/131633.htmlVC/C++/python浜ゆ祦(瓚呯駭) 緹?88028655
嬈㈣繋璧勬繁鎴栧嵆灝嗚祫娣辯殑C++鎶鏈漢鍛橈紝
c/c++/vc/mfc/python

綰疌/C++鎶鏈?鏅?緹?
43568864








澶╀笅 2010-10-28 15:21 鍙戣〃璇勮
]]>
精品久久久无码中文字幕| 欧美精品丝袜久久久中文字幕 | 久久久精品波多野结衣| 国产精品久久久久久吹潮| 国产午夜精品久久久久免费视| 久久99精品久久久久久动态图| 无码专区久久综合久中文字幕| 国产精品99久久久久久人| 国产精品嫩草影院久久| 伊人色综合久久天天网| 97久久久久人妻精品专区| 久久AAAA片一区二区| 亚洲午夜久久久久久久久电影网| 久久国产乱子伦精品免费强| 精品久久久久中文字| 色综合久久久久久久久五月| A级毛片无码久久精品免费| 成人综合久久精品色婷婷| 久久精品成人国产午夜| 日韩欧美亚洲综合久久| 一本大道加勒比久久综合| 2021最新久久久视精品爱| 91精品免费久久久久久久久| 99精品久久久久久久婷婷| 99久久精品国产一区二区| 一本色道久久综合亚洲精品| 国产亚洲精午夜久久久久久| 亚洲欧美伊人久久综合一区二区 | 国产精品久久久久国产A级| 久久久中文字幕日本| 国产午夜精品久久久久免费视| 久久精品国产99国产精品| 2020久久精品国产免费| 久久久SS麻豆欧美国产日韩| 久久黄色视频| 精品国产婷婷久久久| 97久久综合精品久久久综合| 国产成人久久精品一区二区三区| 久久国产视屏| 精品久久久久久无码中文野结衣| 99re这里只有精品热久久|