Two newbie questions
Arkaitz
ma9aba at bath.ac.uk
Tue Jun 13 11:56:59 EDT 2000
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.
More information about the Python-list
mailing list