如何运用JUPYTER NOTEBOOK的问号

2025-10-23 13:25:51

1、打开JUPYTER NOTEBOOK,新建一个空白的PY文档。

如何运用JUPYTER NOTEBOOK的问号

2、a = [2, 999, 3232]

a?

Type:        listString form: [2, 999, 3232]Length:      3Docstring:  list() -> new empty listlist(iterable) -> new list initialized from iterable's items

定义一个列表,列表加上问号,可以查看这个列表的详情。

如何运用JUPYTER NOTEBOOK的问号

3、?a

如果把问号放在前面也是一样的,根据个人习惯定义即可。

如何运用JUPYTER NOTEBOOK的问号

4、print?

Docstring:print(value, ..., sep=' ', end='\n', file=sys.stdout, flush=False)Prints the values to a stream, or to sys.stdout by default.Optional keyword arguments:file:  a file-like object (stream); defaults to the current sys.stdout.sep:   string inserted between values, default a space.end:   string appended after the last value, default a newline.flush: whether to forcibly flush the stream.Type:      builtin_function_or_method

print是自带的function,也是可以用?查看用法。

如何运用JUPYTER NOTEBOOK的问号

5、def plus(x, y):

    'plus 2 numbers together'

    return x * y

plus?

Signature: plus(x, y)Docstring: plus 2 numbers togetherFile:      c:\users\danson\desktop\<ipython-input-20-e41ef1d43fd2>Type:      function

定义一个函数,也是可以查看该函数的信息。

如何运用JUPYTER NOTEBOOK的问号

6、plus??

Signature: plus(x, y)Source:   def plus(x, y):    'plus 2 numbers together'    return x * yFile:      c:\users\danson\desktop\<ipython-input-20-e41ef1d43fd2>Type:      function

如果要更具体的信息,可以加两个问号,对于长篇的编程来看,也是非常方便就可以查看函数的。

如何运用JUPYTER NOTEBOOK的问号

7、oo = {'a': 332, 'b': 32423, 'c':1231}

oo?

Type:        dictString form: {'a': 332, 'b': 32423, 'c': 1231}Length:      3Docstring:  dict() -> new empty dictionarydict(mapping) -> new dictionary initialized from a mapping object's    (key, value) pairsdict(iterable) -> new dictionary initialized as if via:    d = {}    for k, v in iterable:        d[k] = vdict(**kwargs) -> new dictionary initialized with the name=value pairs    in the keyword argument list.  For example:  dict(one=1, two=2)

字典和列表一样,也是可以查看调用的。

如何运用JUPYTER NOTEBOOK的问号

8、pp = (3, 1, 5, 0)

pp?

Type:        tupleString form: (3, 1, 5, 0)Length:      4Docstring:  tuple() -> empty tupletuple(iterable) -> tuple initialized from iterable's itemsIf the argument is a tuple, the return value is the same object.

数组当然和列表和字典是一样可以这么操作查看的。

如何运用JUPYTER NOTEBOOK的问号

声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
猜你喜欢