Dear python users,
In interactive mode, I was wondering if there is a way to list all
declared variables and functions (and from global workspace).
Thanks,
-frankie 3 2698
On 9 May 2005 09:58:19 -0700, ohms377 <fr***********@gmail.com> wrote: Dear python users, In interactive mode, I was wondering if there is a way to list all declared variables and functions (and from global workspace). x = 12 z = 13 import re locals()
{'__builtins__': <module '__builtin__' (built-in)>, 're': <module 're' from'/us
r/lib/python2.4/re.pyc'>, 'x': 12, '__name__': '__main__', 'z': 13, '__doc__': N
one} locals().keys()
['__builtins__', 're', 'x', '__name__', 'z', '__doc__'] globals()
{'__builtins__': <module '__builtin__' (built-in)>, 're': <module 're' from'/us
r/lib/python2.4/re.pyc'>, 'x': 12, '__name__': '__main__', 'z': 13, '__doc__': N
one}
Peace
Bill Mill
bill.mill at gmail.com
ohms377 wrote: Dear python users,
In interactive mode, I was wondering if there is a way to list all declared variables and functions (and from global workspace).
In [1]: def foo(): pass
...:
In [2]: x=1
In [3]: a='hello'
In [4]: import re
In [5]: whos
Variable Type Data/Info
--------------------------------
a str hello
foo function <function foo at 0x403b725c>
re module <module 're' from '/usr/lib/python2.3/re.pyc'>
x int 1
In [6]: whos int
Variable Type Data/Info
----------------------------
x int 1
This is using ipython for the interactive work.
Cheers,
f
In article <ma**************************************@python.o rg>,
Fernando Perez <fp********@gmail.com> wrote: ohms377 wrote:
Dear python users,
In interactive mode, I was wondering if there is a way to list all declared variables and functions (and from global workspace).
In [1]: def foo(): pass ...:
In [2]: x=1
In [3]: a='hello'
In [4]: import re
In [5]: whos Variable Type Data/Info -------------------------------- a str hello foo function <function foo at 0x403b725c> re module <module 're' from '/usr/lib/python2.3/re.pyc'> x int 1
In [6]: whos int Variable Type Data/Info ---------------------------- x int 1
This is using ipython for the interactive work. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: benyang22 |
last post by:
I have been a long time Matlab user. I Python, I miss Matlab's whos
command.
So I have written a little utility whos.py, which can be downloaded
here:...
|
by: rusttree |
last post by:
I've been tasked with a project to take a large program coded in c++
and a generate a list of the names of every variable and where they are
declared. Are there programs out there that will do...
|
by: Nathan Sokalski |
last post by:
I would like to access variables and functions that I declare in the
Global.asax.vb file. However, I am having trouble doing that. What does the
declaration have to look like in the Global.asax.vb...
|
by: robin.bruce |
last post by:
Hi guys,
I just tried to give advice to a colleague who has a problem program in
C, and I was interested to hear the thoughts of this forum on the
subject.
I've been an occasional programmer...
|
by: Juuso Hukkanen |
last post by:
I am looking for a wish list of things which should be removed from
the C (C99) - due to feature's bad security track record <OT>or
Multithreading unsafety. I need this list for a project intending...
|
by: Tyno Gendo |
last post by:
I don't really need to do this, but I was wondering. Is there some way
of obtaining a list of all the variables that have been declared in a
PHP script ?
Ie. for globals you have $_GLOBAL, is...
|
by: Ramashish Baranwal |
last post by:
Hi,
I want to get a module's contents (classes, functions and variables)
in the order in which they are declared. Using dir(module) therefore
doesn't work for me as it returns a list in...
|
by: Gary Herron |
last post by:
Jacob Davis wrote:
Yuck, YUCK, YUCK! You are breaking *so* many
good-programming-practices, I hardly know where to start.
First off: A python global is not what you think. There are *no*...
|
by: Juha Nieminen |
last post by:
As we know, the keyword "inline" is a bit misleading because its
meaning has changed in practice. In most modern compilers it has
completely lost its meaning of "a hint for the compiler to inline...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
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
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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,...
|
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...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |