Tuesday, July 31, 2007

自动生成googel sitemap urllist文件的python程序

# -*- coding: utf-8 -*-
import cx_Oracle,os,sys

gsmpf=open('c:\Python25\zdx\gsmpidfile.txt','r')#####Uch.decode('Éú³Éµ¥¸ögsmpÎļþµÄidmbcs')
gsmpfid0=gsmpf.readline()
while gsmpfid0:
gsmpfid=gsmpfid0
gsmpfid0=gsmpf.readline()
gsmpfid=int(gsmpfid)+1
gsmpf.close()
gsmpf=open('c:\Python25\zdx\gsmpidfile.txt','a')
gsmpf.write('\n'+str(gsmpfid))
gsmpf.close()#########±£´æÔö¼ÓµÄid

outfileinconf=' '
storeinto=' store_into="C:\Python25\zdx\sitemap'+str(gsmpfid)+'.xml"'
gsconfig=open('c:\python25\goositem\sitemap_gen-1.4\zg2sc1-config.xml','w')
print >> gsconfig,''
print >> gsconfig,"print >> gsconfig,' base_url="http://www.zg2sc.cn/"'
print >> gsconfig,storeinto
print >> gsconfig,' verbose="1"'
print >> gsconfig,' >'
print >> gsconfig,outfileinconf
print >> gsconfig,''




outfile=('C:\Python25\zdx\outgoositemap'+str(gsmpfid)+'.txt')
outgoositemap=open(outfile,'w')## ######Éú³Éµ¥¸ögsmpÎļþ
caridfile=open('c:\Python25\zdx\caridfile.txt','r+a')
mincarid=caridfile.readline() ##########ÉϴζÁÊý¾Ý¿â¼Ç¼µÄ½ØÖÁºÅ
while mincarid:
mincaridthis=mincarid
mincarid=caridfile.readline()
caridfile.close()

#orcl = cx_Oracle.connect('')#######Á¬½ÓÊý¾Ý¿â
orcl = cx_Oracle.connect('')
curs = orcl.cursor()
curs.execute('select max(car_id) from t_car')
maxcarid0=curs.fetchone()
maxcarid=maxcarid0[0]
caridfile=open('c:\Python25\zdx\caridfile.txt','a')########±£´æÕâ´Î¶ÁÈ¡Êý¾ÝµÄ×î´óÖµ
caridfile.write('\n'+str(maxcarid))

sql="select car_id from t_car WHERE (car_id<=:maxcarid and car_id>:mincaridthis and affirm<>2 and saled<>2) order by car_id"
bindvars={'maxcarid':maxcarid,'mincaridthis':mincaridthis} #######¶ÁÊý¾Ý¿âÊý¾Ýдµ½ÎļþÀï
curs.execute(sql,bindvars)
row0 = curs.fetchone()
row=row0[0]
while row row0 = curs.fetchone()
row=row0[0]
outgoositemap.write('http://www.zg2sc.cn/car/detailCar.do?carid='+str(row)+'\n')
curs.close()#######¹Ø±ÕÊý¾Ý¿â
orcl.commit()
caridfile.close()#########¹Ø±ÕÎļþ
outgoositemap.close()

13 Comments:

Anonymous Anonymous said...

generic xanax xanax mg - is xanax good for opiate withdrawal

10:49 PM  
Anonymous Anonymous said...

xanax online xanax and alcohol and lexapro - blue xanax bars 2mg

2:13 AM  
Anonymous Anonymous said...

buy tramadol online buy viagra tramadol - tramadol normal dosage

12:55 PM  
Anonymous Anonymous said...

xanax medication much xanax recreational use - drug interactions with xanax

9:29 PM  
Anonymous Anonymous said...

xanax online xanax side effects 2011 - xanax overdose possible

6:33 AM  
Anonymous Anonymous said...

buy tramadol online buy tramadol online no prescription next day delivery - tramadol for dogs and humans the same

10:11 AM  
Anonymous Anonymous said...

buy cialis without doctor prescription cialis for women - where to buy cialis online in usa

9:47 PM  
Anonymous Anonymous said...

xanax online xanax online no prescription - xanax high feel like

10:11 AM  
Anonymous Anonymous said...

cialis online cialis 200mg - generic cialis canadian

2:48 AM  
Anonymous Anonymous said...

http://buytramadolonlinecool.com/#56411 tramadol 85 93 - tramadol no prescription

5:59 PM  
Anonymous Anonymous said...

http://landvoicelearning.com/#74967 tramadol overdose child - tramadol 50mg 319

1:39 PM  
Anonymous Anonymous said...

buy tramadol buy tramadol discover card - tramadol generic cost

11:13 PM  
Anonymous Anonymous said...

http://staam.org/#10699 tramadol normal dosage - tramadol hcl 50mg reviews

2:46 AM  

Post a Comment

<< Home