safe eval of moderately simple math expressions

Peter Otten __peter__ at web.de
Sat Apr 11 11:31:06 CEST 2009


Joel Hedlund wrote:

> Peter Otten wrote:
>>> def is_it_safe(source):
>>>      return "_" not in source and r'\' not in source
>> 
>>>>> "".join(map(chr, [95, 95, 110, 111, 95, 95]))
>> '__no__'
> 
> But you don't have access to neither map or chr?
> 
> /Joel

>>> '5f5f7374696c6c5f6e6f745f736166655f5f'.decode("hex")
'__still_not_safe__'





More information about the Python-list mailing list