python: no quotes in tuple values?

  • From: "Alex Hall" <mehgcap@xxxxxxxxx>
  • To: <programmingblind@xxxxxxxxxxxxx>
  • Date: Sun, 17 Jan 2010 20:14:03 -0500

Hi all,
I have a python program that is reading values from an ini file with the configobj extension. It works fine for strings and numbers, but I am trying to read a hotkey which must be in the form
(49, win32con.MOD_ALT)
Notice that there are not quotes of any kind around the values in this tuple. This and other tuples will be loaded into a dictionary of hotkey definitions. If I hard-code the value, like
key1=(49, win32con.MOD_ALT)
then it works just fine in the dictionary, like
1 : key1

When read from my ini file, though, the tuple looks like this:
('49', 'win32con.MOD_ALT')
Note, this time, there are single quotes. I need those quotes gone so that the hotkeys dictionary will have the proper values in it. Is there a way to cast a string to something with no quotes? I could turn the 49 into an int, but that does not help the modifier key. Any thoughts? Thanks!

Have a great day,
Email: mehgcap@xxxxxxxxx
View the list's information and change your settings at //

Other related posts: