>data = [ ]>for i in xrange(1,101):> data = "" %i _n, f %i_v))
The function locals() will return a dictionary of variables in the
current scope. This can then be used to reference variables by
name.
x=1
xname = 'x'
print locals()['x']
print locals()[xname]
This prints:
1
1
or for your example.
Peter Jessop wrote:
> Kent
>
> Thanks for your reply.
> The structure is for sending form variables and values to a web server
> with POST.
> I am using urllib.urlencode which accepts a list or dictionary as argument.
>
> The idea is to look for airline tickets.
> The airline I buy from only lets
Kent
Thanks for your reply.
The structure is for sending form variables and values to a web server
with POST.
I am using urllib.urlencode which accepts a list or dictionary as argument.
The idea is to look for airline tickets.
The airline I buy from only lets me search by data but I want to
autom
Peter Jessop wrote:
> Thanks Andre
>
> I realise now I did not make it too clear.
> Basically the variable names are predictable but the values aren't.
>
> Maybe I should have expressed it like this
>
> f0_n = "arbitrayValue"
> f0_v ="another valule"
> f1_n="something else"
> f1_v="etc.."
> ...
André
Thanks a lot for clearing this up for me.
Regards
Peter Jessop
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
On 6/5/06, Peter Jessop <[EMAIL PROTECTED]> wrote:
Thanks AndreI realise now I did not make it too clear.Basically the variable names are predictable but the values aren't.I assumed that. I just recreated the list as you gave it because it was easy :-)
Maybe I should have expressed it like thisf0_
Thanks Andre
I realise now I did not make it too clear.
Basically the variable names are predictable but the values aren't.
Maybe I should have expressed it like this
f0_n = "arbitrayValue"
f0_v ="another valule"
f1_n="something else"
f1_v="etc.."
...
f100_n = "another value"
f100_v = "nexvalue
I'm not sure if it's exactly what you need, but here's something that may come close.On 6/5/06, Peter Jessop <[EMAIL PROTECTED]
> wrote:The best way to explain my problem is with an examplef0_n = "field0"
f0_v ="value0"f1_n="field1"f1_v="value1"...f100_n = "field100"f100_v = "value100"Ok, I'm going