473,398 Members | 2,525 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

eval function

what is and how to use eval function. here is what i read from a python text book, "a built-in function that treats a string as a piece of executable program code"
i dont really know what an executable code is.
kindly explain eval function with a little example so that i can understand better.
thank you
Nov 4 '11 #1
1 2426
bvdet
2,851 Expert Mod 2GB
Following are 2 simple examples:
Expand|Select|Wrap|Line Numbers
  1. >>> eval("2*6")
  2. 12
  3. >>> x = 100
  4. >>> eval('x')
  5. 100
  6. >>> 
Nov 4 '11 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: robcarlton | last post by:
hi everybody I've written this function to make a list of all of an objects attributes and methods (not for any reason, I'm just learning) def list_members(obj) l = dir(obj) return map(lambda...
6
by: amohajer | last post by:
what does eval function do in javascript language and what are its usages?
12
by: Maurice | last post by:
Hi, is it possible to enter a string in code in VB.NET 2005 which will be executed as a codeline during runtime? i.e. I want to declare a new form depending on the string: "Dim frm as new...
2
by: bill | last post by:
In VB.NET 2005, is there an equivalent of the EVAL function available in MSAccess and javascript? I need a way to pass a dynamically generated string (like "2+2") to a function and return 4. ...
5
by: R | last post by:
Hi All, I'm using eval and arrays in foreach and have trouble with adding elements to them - I'm talking about the '' operator. My code is: // creates arrays with the names of columns in...
0
by: Zeba | last post by:
Hi, Can you tell me how does the Eval function know where to find EventID in the following code ? Also, isn't this Eval function same as the DataBinder.Eval ? But MSDN only shows Eval() to be...
1
by: shalini jain | last post by:
Hi, I am facing the problem with eval function. I want to know how to pass a function in eval() when we have to create the function itself. I would better explain my problem with the help of an...
8
by: sonet | last post by:
Many Language have eval function.The C have eval function? How to execute c code in c ? Can i execute c code from a variable(like perl's code ref)? Or i must do this job by using yacc & lex ? All...
6
by: RandomElle | last post by:
Hi there I'm hoping someone can help me out with the use of the Eval function. I am using Access2003 under WinXP Pro. I can successfully use the Eval function and get it to call any function with...
2
by: rdemarco | last post by:
Hi guys I'm trying to use the eval() function to run code that I have previously compiled via string concatenation. Some of it works, for example, I can set the focus to a combo box called...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.