On Tue, 20 Dec 2005 14:56:25 +0000, Richie Hindle wrote:

> 
> [David]
>> I'm trying to write something with the same brevity 
>> as perl's one-liner
>> 
>> eval "\$$1=\$2" while @ARGV && $ARGV[0]=~ /^(\w+)=(.*)/ && shift;
> 
> import sys, re
> for arg in sys.argv[1:]:
>     if re.match(r'\w+=.*', arg):
>         exec arg
>     else:
>         break

That piece of code is quite dangerous, since it is calling exec on an
arbitrary string supplied by a user.



-- 
Steven.

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to