Ron_Adam wrote:
On Mon, 28 Mar 2005 13:39:17 +0200, remi <[EMAIL PROTECTED]> wrote:
Hello,
I have got a list like : mylist = ['item 1', 'item 2','item n'] and
I would like to store the string 'item1' in a variable called s_1,
'item2' in s_2,...,'item i' in 's_i',... The lenght of mylist is fi
On Mon, 28 Mar 2005 13:39:17 +0200, remi <[EMAIL PROTECTED]> wrote:
>Hello,
>
>I have got a list like : mylist = ['item 1', 'item 2','item n'] and
>I would like to store the string 'item1' in a variable called s_1,
>'item2' in s_2,...,'item i' in 's_i',... The lenght of mylist is finite ;-)
Fredrik Lundh a écrit :
variable['s_i']=mylist.pop()
variable['s_' + str(i)]=mylist.pop()
but that while and pop stuff is pretty weird;
Why ? Because it destroys the list ?
maybe you should read the
sections on lists, for loops, and string formatting in the Python tutorial?
here's a shorter
Fredrik Lundh a écrit :
"remi" <[EMAIL PROTECTED]> wrote:
I want to store each item of mylist in a variable (and after "xmlize" it little by little).
why not just process the items in the list?
That's right.
for item in mylist:
print tex2xml(item)
where tex2xml() is the main converting
"remi" <[EMAIL PROTECTED]> wrote:
> I want to store each item of mylist in a variable (and after "xmlize" it
> little by little).
why not just process the items in the list?
for item in mylist:
print tex2xml(item)
--
http://mail.python.org/mailman/listinfo/python-list
"remi" <[EMAIL PROTECTED]> wrote:
> i = 0
> while i<=len(mylist)
>variable['s_i']=mylist.pop()
>i = i+1
variable['s_' + str(i)]=mylist.pop()
but that while and pop stuff is pretty weird; maybe you should read the
sections on lists, for loops, and string formatting in the Python tutor
Fredrik Lundh a écrit :
"remi" <[EMAIL PROTECTED]> wrote:
I have got a list like : mylist = ['item 1', 'item 2','item n'] and I would like to store the
string 'item1' in a variable called s_1, 'item2' in s_2,...,'item i' in 's_i',...
why?
I want to convert a very simple *.tex file into a ver
Patrick Useldinger a écrit :
remi wrote:
Hello,
I have got a list like : mylist = ['item 1', 'item 2','item n']
and I would like to store the string 'item1' in a variable called s_1,
'item2' in s_2,...,'item i' in 's_i',... The lenght of mylist is
finite ;-)
Any ideas ?
Thanks a lot.
Rémi.
remi wrote:
Hello,
I have got a list like : mylist = ['item 1', 'item 2','item n'] and
I would like to store the string 'item1' in a variable called s_1,
'item2' in s_2,...,'item i' in 's_i',... The lenght of mylist is finite ;-)
Any ideas ?
Thanks a lot.
Rémi.
Use a dictionary: variable['s_1
"remi" <[EMAIL PROTECTED]> wrote:
> I have got a list like : mylist = ['item 1', 'item 2','item n'] and I
> would like to store the
> string 'item1' in a variable called s_1, 'item2' in s_2,...,'item i' in
> 's_i',...
why?
--
http://mail.python.org/mailman/listinfo/python-list
Hello,
I have got a list like : mylist = ['item 1', 'item 2','item n'] and
I would like to store the string 'item1' in a variable called s_1,
'item2' in s_2,...,'item i' in 's_i',... The lenght of mylist is finite ;-)
Any ideas ?
Thanks a lot.
Rémi.
--
http://mail.python.org/mailman/listinfo/
11 matches
Mail list logo