I am new to Pyton. I am trying to modify and understand a script someone
else wrote. I am trying to make sense of the following code snippet. I know
line 7 would be best coded with regex. I first would like to understand
what was coded originally. thelistOut looks like a hash to me (I'm more
familiar with perl). Perhaps someone could translate from perl to python
for me - not in code but just in concept.


Here is the code. This script is reading the list thelistOut and then
removing any items in RSMlist and taking the remainder and putting them in
graphAddressOut with the formatting.

This is a SAMPLE of what is in the lists referenced below in the loop:


thelistOut = [(632,
['/usr/local/www/data-dist/mrtg/main/test/172.16.0.23_9.log']), (145,
['/usr/local/www/data-dist/mrtg/main/test/172.16.0.23_13.log']), (0,
['/usr/local/www/data-dist/mrtg/main/test/172.16.0.23_5.log'])]

RSMList = ['172.16.0.1_1', '172.16.0.1_2', '172.16.0.1_3', '172.16.0.1_4',
'172.16.0.1_5']



#--------------------------Loop 1 -------------------------
       
    w = 0
    while w < 45:
       
       fileOut = string.split(thelistOut[w][1][0],".log")
       fileOutSplitedCommon = string.split(fileOut[0], "main/")
       fileOut2D = string.split(fileOutSplitedCommon[1], "/")
       fileOut = string.split(fileOut[0],"data-dist")

       if fileOut2D[1] in RSMList:
          w = w + 1
          continue
       graphAddressOut = tag1 + logUrl + fileOut[1] + extention1 + tag2 +
"<b>SWITCH: " + string.swapcase(fileOut2D[0]) + "&nbsp;&nbsp;&
nbsp;PORT ID: " + fileOut2D[1] + "</b><br>" + imgTitleTag + imgTag1 +
logUrl + fileOut[1] + extention2 + imgTag2 + tag3 + tag5
       outputOut.append(graphAddressOut)
       strOut = strOut + graphAddressOut

       w = w + 1

#--------------------------Loop 1 -------------------------

-- 

Karyn Williams
Network Services Manager
California Institute of the Arts
[EMAIL PROTECTED]
http://www.calarts.edu/network
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to