471,350 Members | 1,729 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,350 software developers and data experts.

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
Expand|Select|Wrap|Line Numbers
  1. for j in c:
  2.     for x in range(0,15,1):
  3.         try:
  4.             print "try1", ,j.contents
  5.             y=x*2
  6.             print y
  7.             print j.contents[y]
  8.             cusine[x]=j.contents[y]
  9.             print "try"
  10.         except:    
  11.             try:
  12.                 print cusine
  13.             except:    
  14.                 print "er"
Jun 28 '07 #1
4 1119
bartonc
6,596 Expert 4TB
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
Expand|Select|Wrap|Line Numbers
  1. for j in c:
  2.     for x in range(0,15,1):
  3.         try:
  4.             print "try1", ,j.contents
  5.             y=x*2
  6.             print y
  7.             print j.contents[y]
  8.             cusine[x]=j.contents[y]
  9.             print "try"
  10.         except:    
  11.             try:
  12.                 print cusine
  13.             except:    
  14.                 print "er"
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.
Jun 28 '07 #2
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.
Jun 28 '07 #3
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
Jun 28 '07 #4
bartonc
6,596 Expert 4TB
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).
Jun 28 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

reply views Thread by H. Scott Buckwalter | last post: by
3 posts views Thread by http://www.visual-basic-data-mining.net/forum | last post: by
7 posts views Thread by David Freeman | last post: by
5 posts views Thread by jung_h_park | last post: by
reply views Thread by XIAOLAOHU | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.