Esempio n. 1
0
 def okbuttondown(self,startstaen,tostaen,starttimeen,frame):
     print "program ok"
     startstaentext = startstaen.get()
     tostaentext = tostaen.get()
     starttimetext = starttimeen.get()
     print startstaentext
     print tostaentext
     print starttimetext
     print "pass this"
     recordlist = spiderpractice.spidereasyone(startstaentext,tostaentext,starttimetext)
     for i in range(recordlist.getlength()):
             #print type(i)
             rd_traincode = Label(frame,text = recordlist.getitem(i)['station_train_code'],height=1,width = 10).grid(row=4+i,column=0,sticky="nsew")
             rd_starttime = Label(frame,text = recordlist.getitem(i)['start_time'],height=1,width = 10).grid(row=4+i,column=1,sticky="nsew")
             rd_arrivetime = Label(frame,text = recordlist.getitem(i)['arrive_time'],height=1,width = 10).grid(row=4+i,column=2,sticky="nsew")
             rd_swz = Label(frame,text = recordlist.getitem(i)['swz_num'] ,height=1,width = 10).grid(row=4+i,column=3,sticky="nsew")
             rd_ydz = Label(frame,text = recordlist.getitem(i)['ydz_num'],height=1,width = 10).grid(row=4+i,column=4,sticky="nsew")
             rd_edz = Label(frame,text = recordlist.getitem(i)['edz_num'],height=1,width = 10).grid(row=4+i,column=5,sticky="nsew")
             rd_rw = Label(frame,text = recordlist.getitem(i)['rw_num'],height=1,width = 10).grid(row=4+i,column=6,sticky="nsew")
             rd_yw = Label(frame,text = recordlist.getitem(i)['yw_num'],height=1,width = 10).grid(row=4+i,column=7,sticky="nsew")
             rd_yz = Label(frame,text = recordlist.getitem(i)['yz_num'],height=1,width = 10).grid(row=4+i,column=8,sticky="nsew")
             rd_wz = Label(frame,text = recordlist.getitem(i)['wz_num'],height=1,width = 10).grid(row=4+i,column=9,sticky="nsew")
             rd_yp = Label(frame,text = recordlist.getitem(i)['canWebBuy'],height=1,width = 10).grid(row=4+i,column=10,sticky="nsew")
Esempio n. 2
0
staname2code = getstaname2code()
#print staname2code
stacode = staname2code.keys()
date = u"2016-02-11"
sta2stalist = []
for fromsta in stacode:
    for tosta in stacode:
        if fromsta != tosta:
            tmp = [fromsta, tosta]
            sta2stalist.append(tmp)
print len(sta2stalist)
for j in range(1):
    print j + 1, "/", len(sta2stalist)
    #recordlist = spiderpractice.spidereasyone(sta2stalist[j][0],sta2stalist[j][1],date)
    recordlist = spiderpractice.spidereasyone(u"合肥", u"淮南", date)
    print recordlist
    if recordlist == -1:
        continue
    else:
        sta2stalistfile = open("./database/%s" % (sta2stalist[j]), "w")
        for i in range(recordlist.getlength()):
            print recordlist.getitem(i)
            sta2stalistfile.write(
                recordlist.getitem(i)['station_train_code'].encode("utf8"))
            sta2stalistfile.write(
                recordlist.getitem(i)['start_time'].encode("utf8"))
            sta2stalistfile.write(
                recordlist.getitem(i)['arrive_time'].encode("utf8"))
            sta2stalistfile.write(
                recordlist.getitem(i)['swz_num'].encode("utf8"))
Esempio n. 3
0
 def okbuttondown(self, startstaen, tostaen, starttimeen, frame):
     print "program ok"
     startstaentext = startstaen.get()
     tostaentext = tostaen.get()
     starttimetext = starttimeen.get()
     print startstaentext
     print tostaentext
     print starttimetext
     print "pass this"
     recordlist = spiderpractice.spidereasyone(startstaentext, tostaentext,
                                               starttimetext)
     for i in range(recordlist.getlength()):
         #print type(i)
         rd_traincode = Label(
             frame,
             text=recordlist.getitem(i)['station_train_code'],
             height=1,
             width=10).grid(row=4 + i, column=0, sticky="nsew")
         rd_starttime = Label(frame,
                              text=recordlist.getitem(i)['start_time'],
                              height=1,
                              width=10).grid(row=4 + i,
                                             column=1,
                                             sticky="nsew")
         rd_arrivetime = Label(frame,
                               text=recordlist.getitem(i)['arrive_time'],
                               height=1,
                               width=10).grid(row=4 + i,
                                              column=2,
                                              sticky="nsew")
         rd_swz = Label(frame,
                        text=recordlist.getitem(i)['swz_num'],
                        height=1,
                        width=10).grid(row=4 + i, column=3, sticky="nsew")
         rd_ydz = Label(frame,
                        text=recordlist.getitem(i)['ydz_num'],
                        height=1,
                        width=10).grid(row=4 + i, column=4, sticky="nsew")
         rd_edz = Label(frame,
                        text=recordlist.getitem(i)['edz_num'],
                        height=1,
                        width=10).grid(row=4 + i, column=5, sticky="nsew")
         rd_rw = Label(frame,
                       text=recordlist.getitem(i)['rw_num'],
                       height=1,
                       width=10).grid(row=4 + i, column=6, sticky="nsew")
         rd_yw = Label(frame,
                       text=recordlist.getitem(i)['yw_num'],
                       height=1,
                       width=10).grid(row=4 + i, column=7, sticky="nsew")
         rd_yz = Label(frame,
                       text=recordlist.getitem(i)['yz_num'],
                       height=1,
                       width=10).grid(row=4 + i, column=8, sticky="nsew")
         rd_wz = Label(frame,
                       text=recordlist.getitem(i)['wz_num'],
                       height=1,
                       width=10).grid(row=4 + i, column=9, sticky="nsew")
         rd_yp = Label(frame,
                       text=recordlist.getitem(i)['canWebBuy'],
                       height=1,
                       width=10).grid(row=4 + i, column=10, sticky="nsew")
Esempio n. 4
0
sta2stalist = []
for fromsta in stacode:
    for tosta in stacode:
        if fromsta != tosta:
            tmp = [fromsta, tosta]
            sta2stalist.append(tmp)
#print len(sta2stalist)
#for j in range(len(sta2stalist)):
for j in range(400000, len(sta2stalist)):
    num = open("numofscan", "r+")
    num.write(str(j))
    num.close
    print j + 1, "/", len(sta2stalist)
    time.sleep(0.2)
    try:
        recordlist = spiderpractice.spidereasyone(sta2stalist[j][0],
                                                  sta2stalist[j][1], date)
    except:
        time.sleep(900)
    #recordlist = spiderpractice.spidereasyone(u"合肥",u"淮南",date)
    #recordlist  = url_usr_agent(u"合肥",u"淮南",date)
    #print recordlist
    if recordlist == -1:
        continue
    else:
        sta2stalistfile = open("./database2/%s" % (sta2stalist[j]), "w")
        for i in range(recordlist.getlength()):
            #print recordlist.getitem(i)
            sta2stalistfile.write(
                recordlist.getitem(i)['station_train_code'].encode("utf8"))
            sta2stalistfile.write(
                recordlist.getitem(i)['start_time'].encode("utf8"))
Esempio n. 5
0
sta2stalist=[]
for fromsta in stacode:
    for tosta in stacode:
        if fromsta != tosta:
            tmp = [fromsta,tosta]
            sta2stalist.append(tmp)
#print len(sta2stalist)
#for j in range(len(sta2stalist)):
for j in range(400000,len(sta2stalist)):
    num = open("numofscan","r+")
    num.write(str(j))
    num.close
    print j+1,"/",len(sta2stalist)
    time.sleep(0.2)
    try:
        recordlist = spiderpractice.spidereasyone(sta2stalist[j][0],sta2stalist[j][1],date)
    except:
        time.sleep(900)
    #recordlist = spiderpractice.spidereasyone(u"合肥",u"淮南",date)
    #recordlist  = url_usr_agent(u"合肥",u"淮南",date)
    #print recordlist
    if recordlist == -1:
        continue
    else:
        sta2stalistfile = open("./database2/%s"%(sta2stalist[j]),"w")
        for i in range(recordlist.getlength()):
            #print recordlist.getitem(i)
            sta2stalistfile.write(recordlist.getitem(i)['station_train_code'].encode("utf8"))
            sta2stalistfile.write(recordlist.getitem(i)['start_time'].encode("utf8"))
            sta2stalistfile.write(recordlist.getitem(i)['arrive_time'].encode("utf8"))
            sta2stalistfile.write(recordlist.getitem(i)['swz_num'].encode("utf8"))
Esempio n. 6
0
staname2code = getstaname2code()
#print staname2code
stacode = staname2code.keys()
date = u"2016-02-11"
sta2stalist=[]
for fromsta in stacode:
    for tosta in stacode:
        if fromsta != tosta:
            tmp = [fromsta,tosta]
            sta2stalist.append(tmp)
print len(sta2stalist)
for j in range(1):
    print j+1,"/",len(sta2stalist)
    #recordlist = spiderpractice.spidereasyone(sta2stalist[j][0],sta2stalist[j][1],date)
    recordlist = spiderpractice.spidereasyone(u"合肥",u"淮南",date)
    print recordlist
    if recordlist == -1:
        continue
    else:
        sta2stalistfile = open("./database/%s"%(sta2stalist[j]),"w")
        for i in range(recordlist.getlength()):
            print recordlist.getitem(i)
            sta2stalistfile.write(recordlist.getitem(i)['station_train_code'].encode("utf8"))
            sta2stalistfile.write(recordlist.getitem(i)['start_time'].encode("utf8"))
            sta2stalistfile.write(recordlist.getitem(i)['arrive_time'].encode("utf8"))
            sta2stalistfile.write(recordlist.getitem(i)['swz_num'].encode("utf8"))
            sta2stalistfile.write(recordlist.getitem(i)['ydz_num'].encode("utf8"))
            sta2stalistfile.write(recordlist.getitem(i)['edz_num'].encode("utf8"))
            sta2stalistfile.write(recordlist.getitem(i)['rw_num'].encode("utf8"))
            sta2stalistfile.write(recordlist.getitem(i)['yw_num'].encode("utf8"))