Two newbie questions

BuCoDI-Rony Steelandt rsteelandt at bucodi.com
Tue Jun 13 12:11:39 EDT 2000


Don't know exactly what you mean, could it be that??
st = "asdfasfasdf"
l = []
for c in st:
    l.append(c)
#process here
#....
#now get string back
s=''
for c in l:
    s= s+ c


Arkaitz a écrit :

> Hi all,
>
> I'm learning Python, as it seems everybody around here :-), and I found two
> problems that I can't find the solution to:
> 1. As the strings are inmutable, if I want to modify the order of the characters
> in the string(e.g. sort them), what I do is:
>
> st = "asdfasfasdf"
> l = []
> for c in st:
>     l.append(c)
>
> Then I process the list, and the problem is that I have no idea of how I can get
> the string back, any help?
> 2. The second question is about random numbers, how can I get a random int between the minimum and maximum integers of the machine?
> The next code doesn't worK
> import sys, random
>
> i = random.randint(-sys.maxint-1, sys.maxint)
>
> Thanks in advance,
>
> Arkaitz.

--
======================================================
Bureau de Conseil et de Développement Informatique
2, Rue Henri Avril
22480 Saint - Nicolas du Pelem

Tél : +33.2.96.29.79.08
Fax : +33.2.96.29.79.09

e-mail : bucodi at worldnet.fr
======================================================





More information about the Python-list mailing list