#内置函数源码def dir (p_object=none): # Real signature unknown; Restored from __doc__ "" "Dir ([Object]), list of strings If called without an argument, return the names In the current scope. Else, return an alphabetized list of names comprising (some of) the attributes of the given object, and of attributes R Eachable from it. If the object supplies a method named __dir__, it'll be used; Otherwise the default Dir () logic is used and returns:for a module object:the module ' s attributes. For a class object:its attributes, and recursively the attributes of its bases. For any other object:its attributes, its class ' s attributes, and recursively the attributes of its class ' s base cl Asses. "" "Return []def divmod (x, y): # Known case of Builtins.divmod" "" "Return the Tuple (x//y, x%y). Invariant:div*y + mod = = x. "" Return (0, 0) def eval (*args, **kwargs): # Real signature Unknown "" "Evaluate th e given source in theContext of globals and locals. The source is a string representing a Python expression or a code object as returned by compile (). The globals must be a dictionary and locals can is any mapping, defaulting to the current globals and locals. If only globals are given, locals defaults to it. "" "Passdef exec (*args, **kwargs): # Real signature Unknown" "" Execute the given source in the context of global S and locals. The source is a string representing one or more Python statements or a code object as returned by compile (). The globals must be a dictionary and locals can is any mapping, defaulting to the current globals and locals. If only globals are given, locals defaults to it. "Pass" Baidu Translator: DEF DIR (pyobjult= None): Unknown real signature; A list of strings from "DIR ([OBJ])" Returns the name in the current scope if no argument is called. Otherwise, returns a list of letter names, including (partial) attributes. The given object and the properties that can be obtained from it. If the object provides a method named Y.dirthix, the method is used, otherwise the default DR () logic is used and returned: for module objects: The properties of the module. Used for class objects: properties and their recursive attribution is the basis of it. For any other object: its properties, the properties of its class, and the properties of the base class that recursively recursively classify. "" returns the [] Devmodd (x, y): Known build instance "returns a tuple (x//y,x%y). Invariants: Div *y+mod==x. Back (0, 0) defeve (*args,**kwargs): Unknown real signature "" evaluates a given source in the context of globalization and natives. The source can be a string representing a python expression. or Caserever () returns the Code object. The global variable must be a dictionary, and the local variable can be any mapping, which defaults to the current global variable and local variable. If only the global variable is given, the local variable defaults to it. "" by Defexec (*args,**kwargs): Unknown real signature "" executes the given source in the global and local context. The source can be a string representing one or more python statements. or Caserever () returns the Code object. The global variable must be a dictionary, and the local variable can be any mapping, which defaults to the current global variable and local variable. If only the global variable is given, the local variable defaults to it. "" via ' direct = ' ' Directory no link: 1 scope2 alpahabetized3 comprising4 reachable5 otherwise6 logic7 recursively8 invariant9 MAPPING10 Evaluate ' context = ' 1 scope [SK?? P] United States [Skop] n. Range, scope, vision, vision, Missile range Vt. Review] {The range of things that a subject, activity, book etc deals with(disciplines, events, books, etc.) <return the names in the present scope: Returns all names of the current range (variable names) >2 alphabetize <=> alphabetize [English ['? LF?] B?TA?Z] Beauty ['? lf?b? ' TA?Z] Vt. in alphabetical order; {To arrange (arranged, arranged) things in order according (consistent) to the letters of the alphabet (alphabet) Alphabetical order} <return an alphabetized list of names comprising (some of) the attributes: Returns a list of variable names sorted alphabetically, including (partial) properties > 3 comprising <=> comprise [k?m ' pra?z] beauty [k?m ' Pra? Z] Vt. to contain; Compose] {If You say this something comprises or is comprised of a number of things or people and you mean it h As them as its parts or members. Contains By... Composition} <comprising (some of) the attributes contains (partial) attributes > 4 reachable [English [' Ri?t?? BL] beauty [' Rit?? BL] adj. available; {Softly reachable soft and reachable zone accessible area reachable OBJEC T-reach Object Reachable AccouNTS successful contact reachable vertex up to vertex reachable neighbor up to neighborhood reachable domain reach Stay Reachable Keep approachable Reachable subnet up to subnet} <and of attributes Reachable from it: and from which you can get The properties of > 5 otherwise [English [??] E?WA?Z] beauty [?? E?RWA?Z] Adv. Otherwise, the other way adj. Other, different, Conj. Otherwise, otherwise] {used when saying anything bad thing would happen if something is isn't done otherwise, otherwise (if not doing something, it will happen)} <otherwise the default dir () logic is used and returns: Otherwise, the Dir () logic will be used and returned (the following value:) > 6 logic [English [' L?d??] K] beauty [' Lɑd?? K] n. Logic logical adj Logical] {A-thinking about something that seems correct and Reasonab Le, or a set of sensible (sensible, reasonable, sensible, conscious, sensed;) reasons for doing something logic; (doing sth.) a reasonable idea. Set of Set of} < logic > 7 recursively [[ri ' K?sivli] adv. recursively; recursive] {Recursively computable recursive computable recursively constructing recursive construction recursively projective recursive projective Recursively invariance recursive invariance include recursively includes all folders in the current folder and its subfolders Recu rsively axiomatizable recursive axiomatic recursively isomorphism recursive isomorphism recursively representative recursive representation Recursively presentable recursive can manifest} <for a class object:its attributes, and recursively the attributes For class object, (return) its properties and recursive attribution > 8 invariant [? n ' Ve?r?? NT] Beauty [? n ' V?r?? NT] adj. n. [number] invariant; {An entity, existence, nature), quantity (volume, quantity, Mass, total ˋkwɑnt?t?/), etc, That is unaltered (unchanging/?n??? lt?d/) by a particular (special) transformation (conversion) of coordinates (coordinates, matching clothing, so that coordination/k????? D?n?ts,-?ne?ts/) invariant; Non-variable Baidu: entities, quantities, etc. that are not affected by a particular coordinate transformation invariant mass constant mass invariant maSS Intrinsic mass Casimir invariant Casimir non-variable Hopf invariant Hopf bifurcation invariants time invariant temporal invariants Invariant point invariant points invariant function invariant functions invariant subgroup invariant subgroups Integral invariant integral invariant integral invariant integral invariants optical invariant optical invariants Optical invariant optical interval} <return the tuple (x//y, x%y). Invariant:div*y + mod = = x. Baidu: Returns the tuple (x//y,x%y). Invariants: Div *y+mod==x? > 9 Mapping <=> Map [English [' M?p??] Beauty [' M?p??] V. Drawing; planning (map's ing form) n. maps; drawing; [number] image] {Texture mapping material map texture mapping texture Map Texture mapping texture map texture mapping map coordinates space mapping spatial map space mapping spatial mapping Space mapping Spatial mapping method Squeeze mapping squeeze map cylindrical mapping cylinder considerate diagram cylindrical mapping Cylinder map cylindrical Mapping cylindrical Map Cylindrical Mapping cylinder mapping concept Mapping concept composition concept Mapping concept map concept Mapping Conceptual mapping concept mapping concept drawing inverse mapping inverse mapping inverse mapping reverse mapping inverse MA pping inverse image inverse mapping material processing inverse algorithm Delete mapping delete map Automatic mapping auto Map Automatic Mapping automatic drawing Automatic Mapping Auto Map Automatic Mapping rollout aerial Mapping aerial mapping Aerial mapping aerial mapping aerial mapping aviation write Image Aerial mapping aerial map} <the Globals must b e A dictionary and locals can is any mapping: the global variable must be a dictionary, and the local variable can be any mapping. Eval (expression[, globals[, locals]) expression--expressions. Globals--variable scope, global namespace, if supplied, must be a Dictionary object. Locals--variable scope, local namespace, if provided, can be any mapping object. > Evaluate [English [? '] V?lj?e?t] beauty [? ' V?lj? ' ET] Vt. to evaluate or appraise; The value VI. Evaluation; Judge how good, useful, or successful something is evaluation, review} <evaluate the given source in the context of globals and locals evaluates the given source (code) > Function dir () in a global and local context Dir ()? Returns a list of the types of variables, methods, and definitions in the current scope when the function has no arguments, and returns a list of properties and methods for the parameter when the parameter is taken. If the parameter contains method __dir__ (), the method is called. If the parameter does not contain __dir__ (), the method will collect the parameter information to the fullest extent. Syntax dir syntax: dir ([object]) Parameter description: Object--objects, variables, types. ---------------------This paragraph from the CSDN blog function divmod () combines the results of the divisor and remainder operations, returning a tuple containing quotient and remainder (A//b, a% b). For example 10/3 = 3 ... 1 (3 + 1) divmod (10,3)---> (3,1) >>> divmod (10,3) (3, 1) >>> function eval () and exec (), you can execute the command in quotation marks, the data type of input () is str eval (input ()), and EXEC (input ()) can directly interpret Input content Usage Scenario: For example, you do an accounting program, to modify the credit card's available amount amount_usable = input (' Please enter the available amount now ') Eval (Amout_uSable), the available amount is changed from the string type to the difference between the number type exec () and eval (): exec () can solve an expression with the = sign, eval () not. Look at the meaning of the word to know whose function eval<=>evaluate beg ... Value. Exec<=>excute Implementation Specific Reference blog: https://www.cnblogs.com/yangmingxianshen/p/7810496.html "
>>> data = {'1':1 , '2':2}>>> text = 'data['1'] = 111' File "<stdin>", line 1 text = 'data['1'] = 111' ^SyntaxError: invalid syntax #外面和里面的引号要区分开。>>> text = "data['1'] = 111">>> text"data['1'] = 111">>> eval(text)Traceback (most recent call last): File "<stdin>", line 1, in <module> File "<string>", line 1 data['1'] = 111
EXEC () and eval () differ from compile () Specific reference blog: https://www.cnblogs.com/yangmingxianshen/p/7810496.html
Dir () Specific: 78940805?utm_source=copy
Dir (), Divmod (), eval (), exec () 2018-10-6