Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > questions about exec...

Reply
Thread Tools

questions about exec...

 
 
Hoesl Hoesl is offline
Junior Member
Join Date: Feb 2010
Posts: 1
 
      02-09-2010
Hi...I am new to programming, I'm trying out all kind of stuff and it is fun.
I just have this question about python..

x = "g = lambda x,y: x+y"
exec(x)
g(1,2) <----that will give me number 3.

f = "g(1,2)"
answer = exec "f"


why will this give me a syntax error? is there ways to assign "g(1,2)" as code not as string so I can execute it?
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Few Questions (HW questions already answered by me) padh.ayo@gmail.com C Programming 10 12-06-2006 05:48 PM
Malloc and free questions - learner questions pkirk25 C Programming 50 10-04-2006 02:22 PM
Questions on Canon 300D and etc. questions regarding digital photography Progressiveabsolution Digital Photography 12 03-24-2005 05:18 PM
Newbie questions - Couple of VC++ questions regarding dlls and VB6 Ali Syed C Programming 3 10-13-2004 10:15 PM
Re: Questions....questions....questions Patrick Michael A+ Certification 0 06-16-2004 04:53 PM



Advertisments