How do I inspect one specific object in IPython
我来自Matlab,习惯于
我知道我也可以在ipython中使用
1 2 3 4 | a = [1,2,3] whos a No variables match your requested type. |
我用的是第二层天篷里的伊普生外壳。
有这个命令吗?
谢谢,亚伦
命令
1 2 3 4 5 6 7 8 9 10 11 12 | whos Variable Type Data/Info ---------------------------- a list n=3 b int 2 c str hello whos list Variable Type Data/Info ---------------------------- a list n=3 |
相关命令
1 2 3 4 5 | who a who list a |
号
要检查特定变量,您需要查找
1 2 3 4 5 6 7 8 | a? Type: list String form: [1, 2, 3] Length: 3 Docstring: list() -> new empty list list(iterable) -> new list initialized from iterable's items |
如果您想要更多关于对象的信息,比如函数。您可以使用两个
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | int?? Type: type String form: <type 'int'> Namespace: Python builtin Docstring: int(x=0) -> int or long int(x, base=10) -> int or long Convert a number or string to an integer, or return 0 if no arguments are given. If x is floating point, the conversion truncates towards zero. If x is outside the integer range, the function returns a long instead. If x is not a number or if base is given, then x must be a string or Unicode object representing an integer literal in the given base. The literal can be preceded by '+' or '-' and be surrounded by whitespace. The base defaults to 10. Valid bases are 0 and 2-36. Base 0 means to interpret the base from the string as an integer literal. >>> int('0b100', base=0) 4 |
。