有些时候我们不清楚python的函数的具体签名的时候,调用可能会报错,这里就是介绍一种简单的方法来获取函数的签名参数。
组件.函数.__signature__
我想要获取streamlit.text_input函数的参数签名
$ python
Python 3.10.12 (main, Jun 11 2023, 05:26:28) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import streamlit
>>> print(streamlit.text_input.__signature__)
(self, label: 'str', value: 'str | SupportsStr | None' = '', max_chars: 'int | None' = None, key: 'Key | None' = None, type: "Literal['default', 'password']" = 'default', help: 'str | None' = None, autocomplete: 'str | None' = None, on_change: 'WidgetCallback | None' = None, args: 'WidgetArgs | None' = None, kwargs: 'WidgetKwargs | None' = None, *, placeholder: 'str | None' = None, disabled: 'bool' = False, label_visibility: 'LabelVisibility' = 'visible') -> 'str | None'
>>>
>>> exit()
原文地址:https://blog.csdn.net/somken/article/details/134807727
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如若转载,请注明出处:http://www.7code.cn/show_48374.html
如若内容造成侵权/违法违规/事实不符,请联系代码007邮箱:suwngjj01@126.com进行投诉反馈,一经查实,立即删除!