473,385 Members | 1,983 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

How can i eval subindex on list[ ][ ] ?

Excuse me, i was trying in too many ways but i couldnt access subindex
on a list , the problem is the next:

I have

indif=[[0,'A'],[1,'B'],[2,'C'],[3,'D']]

and

indic=[[0,'B'],[1,'C'],[2,'D'],[3,'E']]

i need to eval if indic[i][j] is equal to indif[i][j]

I used a double for but i had got "list index out of range". How can i
do ???

Thanks a lot,

Cordially,

jDSL

Jan 16 '07 #1
4 1397
jairodsl wrote:
Excuse me, i was trying in too many ways but i couldnt access subindex
on a list , the problem is the next:

I have

indif=[[0,'A'],[1,'B'],[2,'C'],[3,'D']]

and

indic=[[0,'B'],[1,'C'],[2,'D'],[3,'E']]

i need to eval if indic[i][j] is equal to indif[i][j]

I used a double for but i had got "list index out of range". How can i
do ???

Thanks a lot,

Cordially,

jDSL
pyi = 1
pyj = 0
pyindif[i][j] == indic[i][j]
True
Works for me.

James
Jan 16 '07 #2

"James Stroud" <js*****@mbi.ucla.eduwrote in message
news:eo**********@zinnia.noc.ucla.edu...
| jairodsl wrote:
| Excuse me, i was trying in too many ways but i couldnt access subindex
| on a list , the problem is the next:
| >
| I have
| >
| indif=[[0,'A'],[1,'B'],[2,'C'],[3,'D']]
| >
| and
| >
| indic=[[0,'B'],[1,'C'],[2,'D'],[3,'E']]
| >
| i need to eval if indic[i][j] is equal to indif[i][j]
| >
| I used a double for but i had got "list index out of range". How can i
| do ???
| >
| Thanks a lot,
| >
| Cordially,
| >
| jDSL
| >
|
| pyi = 1
| pyj = 0
| pyindif[i][j] == indic[i][j]
| True

Or, if you mean for every i and j, just

indif == indic

and let the types equality method do the work for you.

Jan 17 '07 #3
At Tuesday 16/1/2007 20:08, jairodsl wrote:
>Excuse me, i was trying in too many ways but i couldnt access subindex
on a list , the problem is the next:

I have

indif=[[0,'A'],[1,'B'],[2,'C'],[3,'D']]

and

indic=[[0,'B'],[1,'C'],[2,'D'],[3,'E']]

i need to eval if indic[i][j] is equal to indif[i][j]

I used a double for but i had got "list index out of range". How can i
do ???
Posting your actual code would help. indif[i][j] should be fine, if i
is between 0 and 3 inclusive, and j is 0 or 1.
--
Gabriel Genellina
Softlab SRL


__________________________________________________
Preguntá. Respondé. Descubrí.
Todo lo que querías saber, y lo que ni imaginabas,
está en Yahoo! Respuestas (Beta).
¡Probalo ya!
http://www.yahoo.com.ar/respuestas

Jan 17 '07 #4

its working for me i think its better to mention the value of i and j
for both lists or you might have done mistake while formatting strings
it should be %s for strings and %d for numbers if any subelement in
lists does not formatted properly it may lead to error

Jan 17 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Angelo Secchi | last post by:
I'm trying to use eval (is the right function? ) to generate empty lists with different names(es. list_1, list_2, list_3, ...) in a loop similar to: for index in range(1,4): list= for index in...
18
by: Joe Fallon | last post by:
I have some complex logic which is fairly simply to build up into a string. I needed a way to Eval this string and return a Boolean result. This code works fine to achieve that goal. My...
15
by: manstey | last post by:
Hi, I have a text file called a.txt: # comments I read it using this:
8
by: rdrink | last post by:
n.n.h. (noob needs help) Ok, I've been beating my head against this for a day... time to ask others. To explain things as simply as possible: I am trying to use eval() to evaluate some simple...
8
by: abhishek | last post by:
>>a,b=3,4 7 Now I want to evaluate y by substituting for the evaluated value of x. eval(y) will try to add "a+b" to 3 and return an error. I could do this, 10 but this becomes unwieldy if I...
8
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - When should I use eval? ----------------------------------------------------------------------- The ` eval() `...
1
by: =?ISO-8859-1?Q?Tor_Erik_S=F8nvisen?= | last post by:
Hi, A while ago I asked a question on the list about a simple eval function, capable of eval'ing simple python constructs (tuples, dicts, lists, strings, numbers etc) in a secure manner:...
0
by: J. Clifford Dyer | last post by:
On Tue, 2007-12-11 at 16:55 -0800, katie smith wrote: Katie, First, please provide a useful subject heading when posting to the list. It makes everyone's life easier when searching the...
6
by: RandomElle | last post by:
Hi there I'm hoping someone can help me out with the use of the Eval function. I am using Access2003 under WinXP Pro. I can successfully use the Eval function and get it to call any function with...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.