Hi all,

i need script which open two text files and take first word from the 
first file, runn throught first fords of second file and give me result 
if its there or not...

what i have so far is:

import re, string

# Nacitanie suborov na porovnanie
subor1 = open("snow.txt", "r")
subor2 = open("anakin.txt", "r")

def prehladaj(najdi):
    for riadok1 in subor2.readlines():
        z = riadok1.rsplit(" ")
        if najdi in z[2]:
            return z[3]
       
def porovnaj():
    for riadok in subor1.readlines():
        x = riadok.rsplit(" ") #rozdelime do array dany riadok kde v 2 
bude nazov a verzia v 3
        print x[2] + "    " + x[3]
        print prehladaj(x[2])
   
   

#vytvorenie tabulky
print "     Server: snow                                  Server: anakin"
print "--------------------------------------------------------------------"
print "   Name     Version                                   Version"
porovnaj()

subor1.close()
subor2.close()



the snow.txt looks like:

  B3693AA C.03.86.00     HP GlancePlus/UX for s800 11i
  B3901BA B.11.11.14     HP C/ANSI C Developer's Bundle for HP-UX (S800)
  B3913DB C.03.65        HP aC++ Compiler (S800)
  B4967AA C.03.86.00     HP MeasureWare Server Agent for s800 11i
  B5458DA C.01.18.04     HP-UX Runtime Environment for Java*
  B5725AA B.3.5.89       HP-UX Installation Utilities (Ignite-UX)

etc...

anakint.txt is the same but different versions of programs.... im not 
sure why tmi script dont work ( only for first one )


What i basicaly need is to look up if version of programs match on bouth 
text files diff in linux wont work for it cause there are not the same 
programs on the same lines...

Any idea why mi script is not working or any suggestion for different 
aproach ?

Best regards
Vladimir

_______________________________________________
Tutor maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/tutor

Reply via email to