How can I view a feature in any field by name? My first test is to use globals () and local people () eg
& gt; & Gt; & Gt; Def foo (name): ... a = 1 ... print global (). Get (name), localals () Get (name) ... & gt; & Gt; & Gt; Foo ('A') None 1 & gt; & Gt; & Gt; B = 1 & gt; & Gt; & Gt; Foo ('b') 1 None & gt; & Gt; & Gt; Foo ('foo') & lt; Function Foo 0x014744B0 & gt; Anyone
so far is so good. However it fails to see any underlying names.
& gt; & Gt; & Gt; Range & lt; Built-in function range & gt; & Gt; & Gt; & Gt; Foo ('Category') None None & gt; & Gt; & Gt; Int and lt; Type 'int' & gt; & Gt; & Gt; & Gt; itemprop = "text"> & gt; & Gt; & Gt; Getattr (__Biltins_, 'Category') & lt; Built-in function range & gt;
Comments
Post a Comment