Hi Everyone,
i have another question. What if i wanted to make n tuples, each with
a list of coordinates. For example :
coords = list()
for h in xrange(1,11,1):
for i in xrange(1, 5, 1) :
for j in xrange(1, 5, 1) :
for k in xrange(1,2,1) :
coords.append((i,j,k))
lista+str(h)= tuple coords
print tuple(coords)
so that i will have tuple1, tuple2,..., tupleN, etc. I am trying to do
it the way i show you above but it is not working properly. I wish you
could help me with that. Thanks again, 10 975
victor.hera...@gmail.com:
Do you mean something like this? (notice the many formatting
differences, use a formatting similar to this one in your code)
coords = []
for i in xrange(1, 5):
for j in xrange(1, 5):
for k in xrange(1, 2):
coords.append( (i, j, k) )
coords *= 10
print coords
Bye,
bearophile
On 5 ÉÀÎ, 01:57, "victor.hera...@gmail.com" <victor.hera...@gmail.com>
wrote:
Hi Everyone,
i have another question. What if i wanted to make n tuples, each with
a list of coordinates. For example :
coords = list()
for h in xrange(1,11,1):
for i in xrange(1, 5, 1) :
for j in xrange(1, 5, 1) :
for k in xrange(1,2,1) :
coords.append((i,j,k))
lista+str(h)= tuple coords
print tuple(coords)
so that i will have tuple1, tuple2,..., tupleN, etc. I am trying to do
it the way i show you above but it is not working properly. I wish you
could help me with that. Thanks again,
>>from itertools import repeat, izip coords = tuple((i,j,k) for i in xrange(1,5) for j in xrange(1,5) for kin xrange(1,2)) locals().update(("tuple%s" % i, coord) for i, coord in izip(xrange(1,11), repeat(coords))) tuple1
((1, 1, 1), (1, 2, 1), (1, 3, 1), (1, 4, 1), (2, 1, 1), (2, 2, 1), (2,
3, 1), (2
, 4, 1), (3, 1, 1), (3, 2, 1), (3, 3, 1), (3, 4, 1), (4, 1, 1), (4, 2,
1), (4, 3
, 1), (4, 4, 1))
Does this help?
But I don't understand why you need this?
Ivan
On Jun 5, 3:49 pm, Ivan Illarionov <ivan.illario...@gmail.comwrote:
On 5 ÉÀÎ, 01:57, "victor.hera...@gmail.com" <victor.hera...@gmail.com>
wrote:
Hi Everyone,
i have another question. What if i wanted to make n tuples, each with
a list of coordinates. For example :
coords = list()
for h in xrange(1,11,1):
for i in xrange(1, 5, 1) :
for j in xrange(1, 5, 1) :
for k in xrange(1,2,1) :
coords.append((i,j,k))
lista+str(h)= tuple coords
print tuple(coords)
so that i will have tuple1, tuple2,..., tupleN, etc. I am trying to do
it the way i show you above but it is not working properly. I wish you
could help me with that. Thanks again,
>from itertools import repeat, izip coords = tuple((i,j,k) for i in xrange(1,5) for j in xrange(1,5) fork in xrange(1,2)) locals().update(("tuple%s" % i, coord) for i, coord in izip(xrange(1,11), repeat(coords))) tuple1
((1, 1, 1), (1, 2, 1), (1, 3, 1), (1, 4, 1), (2, 1, 1), (2, 2, 1), (2,
3, 1), (2
, 4, 1), (3, 1, 1), (3, 2, 1), (3, 3, 1), (3, 4, 1), (4, 1, 1), (4, 2,
1), (4, 3
, 1), (4, 4, 1))
Does this help?
But I don't understand why you need this?
Ivan
Hi,
What i need is, for example:
tuple 1=((1, 1, 1), (1, 2, 1), (1, 3, 1), (1, 4, 1))
tuple 2=((2, 1, 1), (2, 2, 1), (2, 3, 1), (2, 4, 1))
tuple 3=((3, 1, 1), (3, 2, 1), (3, 3, 1), (3, 4, 1))
and so on. Please help me and sorry for not taking the time to post my
questions properly.
Victor
On 5 июн, 18:19, "victor.hera...@gmail.com" <victor.hera...@gmail.com>
wrote:
On Jun 5, 3:49 pm, Ivan Illarionov <ivan.illario...@gmail.comwrote:
On 5 ÉÀÎ, 01:57, "victor.hera...@gmail.com" <victor.hera....@gmail.com>
wrote:
Hi Everyone,
i have another question. What if i wanted to make n tuples, each with
a list of coordinates. For example :
coords = list()
for h in xrange(1,11,1):
for i in xrange(1, 5, 1) :
for j in xrange(1, 5, 1) :
for k in xrange(1,2,1) :
coords.append((i,j,k))
lista+str(h)= tuple coords
print tuple(coords)
so that i will have tuple1, tuple2,..., tupleN, etc. I am trying to do
it the way i show you above but it is not working properly. I wish you
could help me with that. Thanks again,
>>from itertools import repeat, izip
>>coords = tuple((i,j,k) for i in xrange(1,5) for j in xrange(1,5) for k in xrange(1,2))
>>locals().update(("tuple%s" % i, coord) for i, coord in izip(xrange(1,11), repeat(coords)))
>>tuple1
((1, 1, 1), (1, 2, 1), (1, 3, 1), (1, 4, 1), (2, 1, 1), (2, 2, 1), (2,
3, 1), (2
, 4, 1), (3, 1, 1), (3, 2, 1), (3, 3, 1), (3, 4, 1), (4, 1, 1), (4, 2,
1), (4, 3
, 1), (4, 4, 1))
Does this help?
But I don't understand why you need this?
Ivan
Hi,
What i need is, for example:
tuple 1=((1, 1, 1), (1, 2, 1), (1, 3, 1), (1, 4, 1))
tuple 2=((2, 1, 1), (2, 2, 1), (2, 3, 1), (2, 4, 1))
tuple 3=((3, 1, 1), (3, 2, 1), (3, 3, 1), (3, 4, 1))
and so on. Please help me and sorry for not taking the time to post my
questions properly.
Victor
>>coords = [(i, tuple((i,j,k) for j in range(1,5) for k in range(1,2))) for i in range(1,5)] locals().update(("tuple_%s" % i, coord) for i, coord in coords) tuple_1
((1, 1, 1), (1, 2, 1), (1, 3, 1), (1, 4, 1))
>>tuple_2
((2, 1, 1), (2, 2, 1), (2, 3, 1), (2, 4, 1))
>>tuple_3
((3, 1, 1), (3, 2, 1), (3, 3, 1), (3, 4, 1))
Is this what you want?
Ivan
On 5 июн, 18:19, "victor.hera...@gmail.com" <victor.hera...@gmail.com>
wrote:
On Jun 5, 3:49 pm, Ivan Illarionov <ivan.illario...@gmail.comwrote:
On 5 ÉÀÎ, 01:57, "victor.hera...@gmail.com" <victor.hera....@gmail.com>
wrote:
Hi Everyone,
i have another question. What if i wanted to make n tuples, each with
a list of coordinates. For example :
coords = list()
for h in xrange(1,11,1):
for i in xrange(1, 5, 1) :
for j in xrange(1, 5, 1) :
for k in xrange(1,2,1) :
coords.append((i,j,k))
lista+str(h)= tuple coords
print tuple(coords)
so that i will have tuple1, tuple2,..., tupleN, etc. I am trying to do
it the way i show you above but it is not working properly. I wish you
could help me with that. Thanks again,
>>from itertools import repeat, izip
>>coords = tuple((i,j,k) for i in xrange(1,5) for j in xrange(1,5) for k in xrange(1,2))
>>locals().update(("tuple%s" % i, coord) for i, coord in izip(xrange(1,11), repeat(coords)))
>>tuple1
((1, 1, 1), (1, 2, 1), (1, 3, 1), (1, 4, 1), (2, 1, 1), (2, 2, 1), (2,
3, 1), (2
, 4, 1), (3, 1, 1), (3, 2, 1), (3, 3, 1), (3, 4, 1), (4, 1, 1), (4, 2,
1), (4, 3
, 1), (4, 4, 1))
Does this help?
But I don't understand why you need this?
Ivan
Hi,
What i need is, for example:
tuple 1=((1, 1, 1), (1, 2, 1), (1, 3, 1), (1, 4, 1))
tuple 2=((2, 1, 1), (2, 2, 1), (2, 3, 1), (2, 4, 1))
tuple 3=((3, 1, 1), (3, 2, 1), (3, 3, 1), (3, 4, 1))
and so on. Please help me and sorry for not taking the time to post my
questions properly.
Victor
Or even so:
locals().update(("tuple_%s" % i, tuple((i,j,k) for j in range(1,5) for
k in range(1,2))) for i in range(1,5))
Ivan
On 5 июн, 18:56, Ivan Illarionov <ivan.illario...@gmail.comwrote:
On 5 июн, 18:19, "victor.hera...@gmail.com" <victor.hera...@gmail.com>
wrote:
On Jun 5, 3:49 pm, Ivan Illarionov <ivan.illario...@gmail.comwrote:
On 5 ÉÀÎ, 01:57, "victor.hera...@gmail.com" <victor.hera...@gmail.com>
wrote:
Hi Everyone,
i have another question. What if i wanted to make n tuples, each with
a list of coordinates. For example :
coords = list()
for h in xrange(1,11,1):
for i in xrange(1, 5, 1) :
for j in xrange(1, 5, 1) :
for k in xrange(1,2,1) :
coords.append((i,j,k))
lista+str(h)= tuple coords
print tuple(coords)
so that i will have tuple1, tuple2,..., tupleN, etc. I am trying to do
it the way i show you above but it is not working properly. I wish you
could help me with that. Thanks again,
>from itertools import repeat, izip
>coords = tuple((i,j,k) for i in xrange(1,5) for j in xrange(1,5)for k in xrange(1,2))
>locals().update(("tuple%s" % i, coord) for i, coord in izip(xrange(1,11), repeat(coords)))
>tuple1
((1, 1, 1), (1, 2, 1), (1, 3, 1), (1, 4, 1), (2, 1, 1), (2, 2, 1), (2,
3, 1), (2
, 4, 1), (3, 1, 1), (3, 2, 1), (3, 3, 1), (3, 4, 1), (4, 1, 1), (4, 2,
1), (4, 3
, 1), (4, 4, 1))
Does this help?
But I don't understand why you need this?
Ivan
Hi,
What i need is, for example:
tuple 1=((1, 1, 1), (1, 2, 1), (1, 3, 1), (1, 4, 1))
tuple 2=((2, 1, 1), (2, 2, 1), (2, 3, 1), (2, 4, 1))
tuple 3=((3, 1, 1), (3, 2, 1), (3, 3, 1), (3, 4, 1))
and so on. Please help me and sorry for not taking the time to post my
questions properly.
Victor
Or even so:
locals().update(("tuple_%s" % i, tuple((i,j,k) for j in range(1,5) for
k in range(1,2))) for i in range(1,5))
Ivan
Tried to make it readable:
def iter_coords(i):
for j in xrange(1,5):
for k in xrange(1,2):
yield i, j, k
def iter_vars():
for i in xrange(1, 5):
yield "tuple_%s" % i, tuple(iter_coords(i))
locals().update(dict(iter_vars()))
>>tuple_1
((1, 1, 1), (1, 2, 1), (1, 3, 1), (1, 4, 1))
>>tuple_2
((2, 1, 1), (2, 2, 1), (2, 3, 1), (2, 4, 1))
>>tuple_3
((3, 1, 1), (3, 2, 1), (3, 3, 1), (3, 4, 1))
>>tuple_4
((4, 1, 1), (4, 2, 1), (4, 3, 1), (4, 4, 1))
Ivan
On Jun 5, 11:21 am, Ivan Illarionov <ivan.illario...@gmail.comwrote:
On 5 июн, 18:56, Ivan Illarionov <ivan.illario...@gmail.comwrote:
On 5 июн, 18:19, "victor.hera...@gmail.com" <victor.hera....@gmail.com>
wrote:
On Jun 5, 3:49 pm, Ivan Illarionov <ivan.illario...@gmail.comwrote:
On 5 ÉÀÎ, 01:57, "victor.hera...@gmail.com" <victor.hera...@gmail.com>
wrote:
Hi Everyone,
i have another question. What if i wanted to make n tuples, each with
a list of coordinates. For example :
coords = list()
for h in xrange(1,11,1):
for i in xrange(1, 5, 1) :
for j in xrange(1, 5, 1) :
for k in xrange(1,2,1) :
coords.append((i,j,k))
lista+str(h)= tuple coords
print tuple(coords)
so that i will have tuple1, tuple2,..., tupleN, etc. I am trying to do
it the way i show you above but it is not working properly. I wishyou
could help me with that. Thanks again,
>>from itertools import repeat, izip
>>coords = tuple((i,j,k) for i in xrange(1,5) for j in xrange(1,5) for k in xrange(1,2))
>>locals().update(("tuple%s" % i, coord) for i, coord in izip(xrange(1,11), repeat(coords)))
>>tuple1
((1, 1, 1), (1, 2, 1), (1, 3, 1), (1, 4, 1), (2, 1, 1), (2, 2, 1), (2,
3, 1), (2
, 4, 1), (3, 1, 1), (3, 2, 1), (3, 3, 1), (3, 4, 1), (4, 1, 1), (4, 2,
1), (4, 3
, 1), (4, 4, 1))
Does this help?
But I don't understand why you need this?
Ivan
Hi,
What i need is, for example:
tuple 1=((1, 1, 1), (1, 2, 1), (1, 3, 1), (1, 4, 1))
tuple 2=((2, 1, 1), (2, 2, 1), (2, 3, 1), (2, 4, 1))
tuple 3=((3, 1, 1), (3, 2, 1), (3, 3, 1), (3, 4, 1))
and so on. Please help me and sorry for not taking the time to post my
questions properly.
Victor
Or even so:
locals().update(("tuple_%s" % i, tuple((i,j,k) for j in range(1,5) for
k in range(1,2))) for i in range(1,5))
Ivan
Tried to make it readable:
def iter_coords(i):
for j in xrange(1,5):
for k in xrange(1,2):
yield i, j, k
def iter_vars():
for i in xrange(1, 5):
yield "tuple_%s" % i, tuple(iter_coords(i))
locals().update(dict(iter_vars()))
locals().update() works by accident here because it's in global scope;
it doesn't work within a function.
Use a proper data structure, like a dict or a list, and access each
tuple list as 'tuples[n]' instead of 'tuple_n'.
George
On 5 июн, 19:38, George Sakkis <george.sak...@gmail.comwrote:
On Jun 5, 11:21 am, Ivan Illarionov <ivan.illario...@gmail.comwrote:
On 5 июн, 18:56, Ivan Illarionov <ivan.illario...@gmail.comwrote:
On 5 июн, 18:19, "victor.hera...@gmail.com" <victor.hera...@gmail.com>
wrote:
On Jun 5, 3:49 pm, Ivan Illarionov <ivan.illario...@gmail.comwrote:
On 5 ÉÀÎ, 01:57, "victor.hera...@gmail.com" <victor..hera...@gmail.com>
wrote:
Hi Everyone,
i have another question. What if i wanted to make n tuples, eachwith
a list of coordinates. For example :
coords = list()
for h in xrange(1,11,1):
for i in xrange(1, 5, 1) :
for j in xrange(1, 5, 1) :
for k in xrange(1,2,1) :
coords.append((i,j,k))
lista+str(h)= tuple coords
print tuple(coords)
so that i will have tuple1, tuple2,..., tupleN, etc. I am tryingto do
it the way i show you above but it is not working properly. I wish you
could help me with that. Thanks again,
>from itertools import repeat, izip
>coords = tuple((i,j,k) for i in xrange(1,5) for j in xrange(1,5) for k in xrange(1,2))
>locals().update(("tuple%s" % i, coord) for i, coord in izip(xrange(1,11), repeat(coords)))
>tuple1
((1, 1, 1), (1, 2, 1), (1, 3, 1), (1, 4, 1), (2, 1, 1), (2, 2, 1),(2,
3, 1), (2
, 4, 1), (3, 1, 1), (3, 2, 1), (3, 3, 1), (3, 4, 1), (4, 1, 1), (4, 2,
1), (4, 3
, 1), (4, 4, 1))
Does this help?
But I don't understand why you need this?
Ivan
Hi,
What i need is, for example:
tuple 1=((1, 1, 1), (1, 2, 1), (1, 3, 1), (1, 4, 1))
tuple 2=((2, 1, 1), (2, 2, 1), (2, 3, 1), (2, 4, 1))
tuple 3=((3, 1, 1), (3, 2, 1), (3, 3, 1), (3, 4, 1))
and so on. Please help me and sorry for not taking the time to post my
questions properly.
Victor
Or even so:
locals().update(("tuple_%s" % i, tuple((i,j,k) for j in range(1,5) for
k in range(1,2))) for i in range(1,5))
Ivan
Tried to make it readable:
def iter_coords(i):
for j in xrange(1,5):
for k in xrange(1,2):
yield i, j, k
def iter_vars():
for i in xrange(1, 5):
yield "tuple_%s" % i, tuple(iter_coords(i))
locals().update(dict(iter_vars()))
locals().update() works by accident here because it's in global scope;
it doesn't work within a function.
Use a proper data structure, like a dict or a list, and access each
tuple list as 'tuples[n]' instead of 'tuple_n'.
George
OP wanted variables and I showed him how to do this. I agree that a
list or a dict would be better.
Ivan
On Jun 5, 11:48 am, Ivan Illarionov <ivan.illario...@gmail.comwrote:
On 5 июн, 19:38, George Sakkis <george.sak...@gmail.comwrote:
On Jun 5, 11:21 am, Ivan Illarionov <ivan.illario...@gmail.comwrote:
On 5 июн, 18:56, Ivan Illarionov <ivan.illario...@gmail..comwrote:
On 5 июн, 18:19, "victor.hera...@gmail.com" <victor.hera...@gmail.com>
wrote:
On Jun 5, 3:49 pm, Ivan Illarionov <ivan.illario...@gmail.comwrote:
On 5 ÉÀÎ, 01:57, "victor.hera...@gmail.com" <victor.hera...@gmail.com>
wrote:
Hi Everyone,
i have another question. What if i wanted to make n tuples, each with
a list of coordinates. For example :
coords = list()
for h in xrange(1,11,1):
for i in xrange(1, 5, 1) :
for j in xrange(1, 5, 1) :
for k in xrange(1,2,1) :
coords.append((i,j,k))
lista+str(h)= tuple coords
print tuple(coords)
so that i will have tuple1, tuple2,..., tupleN, etc. I am trying to do
it the way i show you above but it is not working properly. I wish you
could help me with that. Thanks again,
>>from itertools import repeat, izip
>>coords = tuple((i,j,k) for i in xrange(1,5) for j in xrange(1,5) for k in xrange(1,2))
>>locals().update(("tuple%s" % i, coord) for i, coord in izip(xrange(1,11), repeat(coords)))
>>tuple1
((1, 1, 1), (1, 2, 1), (1, 3, 1), (1, 4, 1), (2, 1, 1), (2, 2, 1), (2,
3, 1), (2
, 4, 1), (3, 1, 1), (3, 2, 1), (3, 3, 1), (3, 4, 1), (4, 1, 1), (4, 2,
1), (4, 3
, 1), (4, 4, 1))
Does this help?
But I don't understand why you need this?
Ivan
Hi,
What i need is, for example:
tuple 1=((1, 1, 1), (1, 2, 1), (1, 3, 1), (1, 4, 1))
tuple 2=((2, 1, 1), (2, 2, 1), (2, 3, 1), (2, 4, 1))
tuple 3=((3, 1, 1), (3, 2, 1), (3, 3, 1), (3, 4, 1))
and so on. Please help me and sorry for not taking the time to post my
questions properly.
Victor
Or even so:
locals().update(("tuple_%s" % i, tuple((i,j,k) for j in range(1,5) for
k in range(1,2))) for i in range(1,5))
Ivan
Tried to make it readable:
def iter_coords(i):
for j in xrange(1,5):
for k in xrange(1,2):
yield i, j, k
def iter_vars():
for i in xrange(1, 5):
yield "tuple_%s" % i, tuple(iter_coords(i))
locals().update(dict(iter_vars()))
locals().update() works by accident here because it's in global scope;
it doesn't work within a function.
Use a proper data structure, like a dict or a list, and access each
tuple list as 'tuples[n]' instead of 'tuple_n'.
George
OP wanted variables and I showed him how to do this. I agree that a
list or a dict would be better.
Ivan
Generating variable names at runtime doesn't work for locals and it is
a bad solution for globals in 99.9% of the cases. It is usually more
helpful to point someone who can't even express his problem clearly to
the right direction, rather than taking his pseudocode literally and
coming up with a semi-working translation.
George
On 5 июн, 21:22, George Sakkis <george.sak...@gmail.comwrote:
On Jun 5, 11:48 am, Ivan Illarionov <ivan.illario...@gmail.comwrote:
On 5 июн, 19:38, George Sakkis <george.sak...@gmail.comwrote:
On Jun 5, 11:21 am, Ivan Illarionov <ivan.illario...@gmail.comwrote:
On 5 июн, 18:56, Ivan Illarionov <ivan.illario...@gmail.comwrote:
On 5 июн, 18:19, "victor.hera...@gmail.com" <victor..hera...@gmail.com>
wrote:
On Jun 5, 3:49 pm, Ivan Illarionov <ivan.illario...@gmail.comwrote:
On 5 ÉÀÎ, 01:57, "victor.hera...@gmail.com" <victor.hera...@gmail.com>
wrote:
Hi Everyone,
i have another question. What if i wanted to make n tuples, each with
a list of coordinates. For example :
coords = list()
for h in xrange(1,11,1):
for i in xrange(1, 5, 1) :
for j in xrange(1, 5, 1) :
for k in xrange(1,2,1) :
coords.append((i,j,k))
lista+str(h)= tuple coords
print tuple(coords)
so that i will have tuple1, tuple2,..., tupleN, etc. I am trying to do
it the way i show you above but it is not working properly. I wish you
could help me with that. Thanks again,
>from itertools import repeat, izip
>coords = tuple((i,j,k) for i in xrange(1,5) for j in xrange(1,5) for k in xrange(1,2))
>locals().update(("tuple%s" % i, coord) for i, coord in izip(xrange(1,11), repeat(coords)))
>tuple1
((1, 1, 1), (1, 2, 1), (1, 3, 1), (1, 4, 1), (2, 1, 1), (2, 2,1), (2,
3, 1), (2
, 4, 1), (3, 1, 1), (3, 2, 1), (3, 3, 1), (3, 4, 1), (4, 1, 1), (4, 2,
1), (4, 3
, 1), (4, 4, 1))
Does this help?
But I don't understand why you need this?
Ivan
Hi,
What i need is, for example:
tuple 1=((1, 1, 1), (1, 2, 1), (1, 3, 1), (1, 4, 1))
tuple 2=((2, 1, 1), (2, 2, 1), (2, 3, 1), (2, 4, 1))
tuple 3=((3, 1, 1), (3, 2, 1), (3, 3, 1), (3, 4, 1))
and so on. Please help me and sorry for not taking the time to post my
questions properly.
Victor
Or even so:
locals().update(("tuple_%s" % i, tuple((i,j,k) for j in range(1,5)for
k in range(1,2))) for i in range(1,5))
Ivan
Tried to make it readable:
def iter_coords(i):
for j in xrange(1,5):
for k in xrange(1,2):
yield i, j, k
def iter_vars():
for i in xrange(1, 5):
yield "tuple_%s" % i, tuple(iter_coords(i))
locals().update(dict(iter_vars()))
locals().update() works by accident here because it's in global scope;
it doesn't work within a function.
Use a proper data structure, like a dict or a list, and access each
tuple list as 'tuples[n]' instead of 'tuple_n'.
George
OP wanted variables and I showed him how to do this. I agree that a
list or a dict would be better.
Ivan
Generating variable names at runtime doesn't work for locals and it is
a bad solution for globals in 99.9% of the cases. It is usually more
helpful to point someone who can't even express his problem clearly to
the right direction, rather than taking his pseudocode literally and
coming up with a semi-working translation.
George
Understanding of how to create variables dynamically can be good for
OP's learning curve even though it's a bad solution in this particular
case.
I agree that it was my mistake to not point him in the right
direction.
Ivan This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Thorsten Kampe |
last post by:
I found out that I am rarely using tuples and almost always lists
because of the more flexible usability of lists (methods, etc.)
To my knowledge, the only fundamental difference between tuples...
|
by: Nickolay Kolev |
last post by:
Hi all,
I have a list whose length is a multiple of 3. I want to get a list of
tuples each of which has 3 consecutive elements from the original list,
thus packing the list into smaller...
|
by: Darren Dale |
last post by:
Hello,
def test(data):
i = ? This is the line I have trouble with
if i==1: return data
else: return data
a,b,c,d = test()
|
by: seberino |
last post by:
Tuples are defined with regards to parentheses ()'s as everyone knows.
This causes confusion for 1 item tuples since (5) can be interpreted
as a tuple OR as the number 5 in a mathematical...
|
by: Richard |
last post by:
I have a large list of two element tuples. I want two separate
lists: One list with the first element of every tuple, and the
second list with the second element of every tuple.
Each tuple...
|
by: Mike Meyer |
last post by:
It seems that the distinction between tuples and lists has slowly been
fading away. What we call "tuple unpacking" works fine with lists on
either side of the assignment, and iterators on the...
|
by: MTD |
last post by:
Hello,
I'm wondering if there's a quick way of resolving this problem.
In a program, I have a list of tuples of form (str,int), where int is a
count of how often str occurs
e.g. L = would...
|
by: C.L. |
last post by:
I was looking for a function or method that would return the index to the first
matching element in a list. Coming from a C++ STL background, I thought it might
be called "find". My first stop was...
|
by: =?utf-8?B?TWFjaWVqIEJsaXppxYRza2k=?= |
last post by:
Hi Pythonistas!
I've got a question about storing tuples in a dictionary. First, a
small test case which creates a list of dictionaries:
import time
list_of_dicts =
keys =
prev_clk =...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
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...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
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...
| |