how can i randomly choose keys in dictionary

2005-02-17 Thread neutrinman
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

what is wrong?

2005-02-24 Thread neutrinman
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

what is wrong?

2005-02-24 Thread neutrinman
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

Re: what is wrong?

2005-02-24 Thread neutrinman
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

how to use property

2005-02-25 Thread neutrinman
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

error: db type could not be determined

2005-02-26 Thread neutrinman
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

Re: error: db type could not be determined

2005-02-27 Thread neutrinman
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

using Tkinter from IDLE

2005-03-03 Thread neutrinman
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.