Hi,there. How can I choose a key in dictionary randomly?
Say, random.choice() in lists,
or in lists:
lists = [1,2,3,4]
position = random.range(len(lists))
word = lists[position]
--
http://mail.python.org/mailman/listinfo/python-list
I cannot find out why the following code generates the error:
Traceback (most recent call last):
File "D:/a/Utilities/python/ptyhon22/test.py", line 97, in ?
main()
File "D:/a/Utilities/python/ptyhon22/test.py", line 60, in main
crit = Critter(crit_name)
File "D:/a/U
I cannot find out why the following code generates the error:
Traceback (most recent call last):
File "D:/a/Utilities/python/ptyhon22/test.py", line 97, in ?
main()
File "D:/a/Utilities/python/ptyhon22/test.py", line 60, in main
crit = Critter(crit_name)
File "D:/a/U
I appreciate all of your help.
I learned a lot form your adovice.
Thanks.
Mr. Bieber, it worked fine. Thanks again.
--
http://mail.python.org/mailman/listinfo/python-list
My question is how should I use "property" which wraps up
__get_channel() and __set_channel()in the following program.
I tried the program that written below, and it worked. Then I tried:
channel = property(__get_channel,__set_channel) as in comment 1, 2,
and 3,
but it genera
why does the following error occur?
def quit_time():
data_file = shelve.open("data.dat", "c")
data_file["quit_time"] = datetime.datetime.today()
print data_file["quit_time"]
raw_input("enter")
Traceback (most recent call last):
File
Thank you for your reply, Jhon.
It was useful advice.
> Take a hint: they say "Google is your friend", but better still is
the
> source in lib\*.py -- it's quite legible, you don't need an Internet
> connection, and there sure ain't no ads in the margin. And don't just
> open it in emergencies: pi
How do I use Tkinter from IDLE? Tkinter can be used from IDLE attached
to python 2.2, IDLE 0.8. But I couldn't use from IDLE attached to
python 2.3, IDLE 1.0.3. When I execute the code below:
from Tkinter import *
root = Tk()
the window appears form IDLE 0.8, but not from IDLE 1.0.3.