list control

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • born2lead
    New Member
    • Jun 2007
    • 11

    #1

    list control

    hi,
    i want to know what is wrong about line no.7 & 8 . in the code below pleasse give an alternate method to im oplement this[CODE=python]
    for j in c:
    for x in range(0,15,1):
    try:
    print "try1", ,j.contents
    y=x*2
    print y
    print j.contents[y]
    cusine[x]=j.contents[y]
    print "try"
    except:
    try:
    print cusine
    except:
    print "er"[/CODE]
    Last edited by bartonc; Jun 28 '07, 08:07 AM. Reason: Added [CODE=python][CODE] tags.
  • bartonc
    Recognized Expert Expert
    • Sep 2006
    • 6478

    #2
    Originally posted by born2lead
    hi,
    i want to know what is wrong about line no.7 & 8 . in the code below pleasse give an alternate method to im oplement this[CODE=python]
    for j in c:
    for x in range(0,15,1):
    try:
    print "try1", ,j.contents
    y=x*2
    print y
    print j.contents[y]
    cusine[x]=j.contents[y]
    print "try"
    except:
    try:
    print cusine
    except:
    print "er"[/CODE]
    First of all, you have not used CODE tags, but I've fixed that. Your little numbering scheme doesn't work at all. Just paste the code surrounded by CODE tags. Instructions on on the right hand side of the page while posting or replying.

    Secondly, you have not given us enough to go on. What should it do? What's in c that you are trying to iterate over? What does the object j look like? Etc., etc.

    Comment

    • born2lead
      New Member
      • Jun 2007
      • 11

      #3
      Originally posted by bartonc
      First of all, you have not used CODE tags, but I've fixed that. Your little numbering scheme doesn't work at all. Just paste the code surrounded by CODE tags. Instructions on on the right hand side of the page while posting or replying.

      Secondly, you have not given us enough to go on. What should it do? What's in c that you are trying to iterate over? What does the object j look like? Etc., etc.
      i am extracting data form a web page. under the heading "menu" it can have 0 item or as much as 15 ITEMs, separated by "<br>". this changes from time to time. so how do i extract the data.
      i dont want to write the code 15 times for each ITEM and try for exception. that is why i tried to loop it but the list j does support an array like structure as in C++.
      my code "print j.contents[y]" where y is a variable does not seem to work.

      Comment

      • born2lead
        New Member
        • Jun 2007
        • 11

        #4
        Originally posted by born2lead
        i am extracting data form a web page. under the heading "menu" it can have 0 item or as much as 15 ITEMs, separated by "<br>". this changes from time to time. so how do i extract the data.
        i dont want to write the code 15 times for each ITEM and try for exception. that is why i tried to loop it but the list j does support an array like structure as in C++.
        my code "print j.contents[y]" where y is a variable does not seem to work.
        please help. its urgent

        Comment

        • bartonc
          Recognized Expert Expert
          • Sep 2006
          • 6478

          #5
          Originally posted by born2lead
          please help. its urgent
          You still need to post more of the code in order for anyone to know what the heck you are trying to do. (See #2, above).

          Comment

          Working...