pythonの強さ:)

1499 ワード

pythonの強さ:)
昨日の問題、やっと分かった、oracle 8のやった鬼で、怠け者はまた何かを探して駆動しました.pythonが張駿の助けでよかったことを思い出して、私に半分の知識からコードを書くことまで理解させました.
pythonのコードを使うのは明らかに簡潔で、コードの柔軟性が好きです.
import cx_Oracle 

def parse(): 
    '''generate the content html''' 

    sql = '''select t.bz_code code, t.bz_title title, t.bz_content content 
        from bz_czzs t 
        order by t.bz_code''' 

    connection = cx_Oracle.connect( 'etasadmin/etasadmin@zhongju' ) 
    cursor = connection.cursor() 
    cursor.execute(sql) 
    item=cursor.fetchone() 
    i=1; 
    print 'begin' 
    while item: 
        i+=1 
        print 'parsing ',i,' item....' 
        writeContent(item[0],item[1],str(item[2])) 
        item=cursor.fetchone() 

    print 'end' 
def writeContent(code,title,content): 
    filename='D:\\workspace\\style\\test\\content_body.html'    
    s = getContent(code,title,content)
    out = open(filename,'a') 
    out.write(s) 
    out.flush() 
    out.close() 
    
if __name__=='__main__': 
    print 'parse..................'    
    parse() 
    print 'end'

よく勉強しなければなりませんね.python素晴らしいo_o