In article <[EMAIL PROTECTED]>,
manstey <[EMAIL PROTECTED]> wrote:
>
>Thanks. I didn't know eval could do that. But why do many posts say
>they want a solution that doesn't use eval?
Because it is a security risk!
eval("os.system('rm -rf /')")
--
Aahz ([EMAIL PROTECTED]) <*> h
manstey wrote:
> Thanks. I didn't know eval could do that. But why do many posts say
> they want a solution that doesn't use eval?
>
Because it is a sledgehammer: capable of driving in nails or breaking
rocks. Most times people say 'I want to use eval' they are using it to
drive nails and some
Thanks. I didn't know eval could do that. But why do many posts say
they want a solution that doesn't use eval?
--
http://mail.python.org/mailman/listinfo/python-list
I am sure something much more elaborate will show it's face but this I
made in about 10 minutes. Didn't do much testing on it but it certainly
does convert your string modeled after a dictionary into a real
dictionary. You might wish to check against more variations and
possibilities and tweak and
manstey wrote:
> Hi,
>
> How do I convert a string like:
> a="{'syllable': u'cv-i b.v^ y^-f', 'ketiv-qere': 'n', 'wordWTS': u'8'}"
>
> into a dictionary:
> b={'syllable': u'cv-i b.v^ y^-f', 'ketiv-qere': 'n', 'wordWTS': u'8'}
Try this recipe:
http://aspn.activestate.com/ASPN/Cookbook/Python/Reci
Am Mittwoch 24 Mai 2006 07:52 schrieb manstey:
> Hi,
>
> How do I convert a string like:
> a="{'syllable': u'cv-i b.v^ y^-f', 'ketiv-qere': 'n', 'wordWTS': u'8'}"
>
> into a dictionary:
> b={'syllable': u'cv-i b.v^ y^-f', 'ketiv-qere': 'n', 'wordWTS': u'8'}
b = eval(a)
(if a contains a dict-repr)
manstey wrote:
> Hi,
>
> How do I convert a string like:
> a="{'syllable': u'cv-i b.v^ y^-f', 'ketiv-qere': 'n', 'wordWTS': u'8'}"
>
> into a dictionary:
> b={'syllable': u'cv-i b.v^ y^-f', 'ketiv-qere': 'n', 'wordWTS': u'8'}
>
> Thanks, Matthew
>
> PS why in Python is it so often easy to conv
Hi,
How do I convert a string like:
a="{'syllable': u'cv-i b.v^ y^-f', 'ketiv-qere': 'n', 'wordWTS': u'8'}"
into a dictionary:
b={'syllable': u'cv-i b.v^ y^-f', 'ketiv-qere': 'n', 'wordWTS': u'8'}
Thanks, Matthew
PS why in Python is it so often easy to convert one way but not the
other?
--
ht