J
Jorgen Bodde
Hi All,
I have a dictionary with settings. The settinfgs can be strings, ints
or bools. I would like to write this list dynamically to disk in a big
for loop, unfortunately the bools need to be written as 0 or 1 to the
config with WriteInt, the integers also with WriteInt and the strings
with a simple Write.
The list is something like;
options[A] = True
options = 1
options[C] = "Hello"
I wanted to use isinstance to determine if it is a bool or an int or a
string. However I am confused trying it out in the interactive editor;
.... print "OK"
....
OK.... print "OK"
....
OK
I don't get it. is the bool derived from 'int' in some way? What is
the best way to check if the config I want to write is an int or a
bool ?
Regards,
- Jorgen
I have a dictionary with settings. The settinfgs can be strings, ints
or bools. I would like to write this list dynamically to disk in a big
for loop, unfortunately the bools need to be written as 0 or 1 to the
config with WriteInt, the integers also with WriteInt and the strings
with a simple Write.
The list is something like;
options[A] = True
options = 1
options[C] = "Hello"
I wanted to use isinstance to determine if it is a bool or an int or a
string. However I am confused trying it out in the interactive editor;
.... print "OK"
....
OK.... print "OK"
....
OK
I don't get it. is the bool derived from 'int' in some way? What is
the best way to check if the config I want to write is an int or a
bool ?
Regards,
- Jorgen