[Python] Find available methods and help in REPL
Python in and Find available methods help
2023-09-14 08:59:17 时间
For example you want to know what methods are available in Python for String, you can do :
dir("xxx")
Output:
>>> dir("string") ['__add__', '__class__', '__contains__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__getnewargs__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__mod__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__rmod__', '__rmul__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', 'capitalize', 'casefold', 'center', 'count', 'encode', 'endswith', 'expandtabs', 'find', 'format', 'format_map', 'index', 'isalnum', 'isalpha', 'isdecimal', 'isdigit', 'isidentifier', 'islower', 'isnumeric', 'isprintable', 'isspace', 'istitle', 'isupper', 'join', 'ljust', 'lower', 'lstrip', 'maketrans', 'partition', 'replace', 'rfind', 'rindex', 'rjust', 'rpartition', 'rsplit', 'rstrip', 'split', 'splitlines', 'startswith', 'strip', 'swapcase', 'title', 'translate', 'upper', 'zfill']
Now for example, we want to see How to use 'swapcase' method:
help("foo".swapcase)
It will show example and description about the method, which is very useful
相关文章
- Python获取时间戳_python爬虫时间戳
- pycharm自带python环境吗_Python IDE环境之 新版Pycharm安装详细教程[通俗易懂]
- python中dtype的使用规范_Python numpy.dtype() 使用实例
- 5款最强且免费的Python IDE
- 怎么用python打开csv文件_Python文本处理之csv-csv文件怎么打开[通俗易懂]
- python基础(9)增强型赋值与使用普通赋值的区别
- 【说站】python 如何调用api
- 用python的shutil库批量移动文件及批量重命名
- python学生管理系统代码_用python写学生管理系统
- PYTHON主机_我的Python世界PDF
- python定义函数求和_Python定义函数实现累计求和操作
- ROS2机器人编程简述humble-第三章-BUMP AND GO BEHAVIOR IN PYTHON .4
- python-Python与SQLite数据库-处理SQLite查询结果(一)
- Python的Flask框架使用Redis做数据缓存的配置方法
- python去除列表里的重复元素的集中方法汇总详解编程语言
- python入门(七):CGI编程详解编程语言
- Python中函数的参数传递与可变长参数详解编程语言
- 使用Python操作MySQL数据库快速上手(python访问mysql数据库)
- Linux升级:升级Python到最新版本(linux升级python版本)
- Python驱动Oracle数据库(python操作oracle)
- Python 开发者如何正确使用 RStudio 编辑器
- Python中int()函数的用法
- Oracle的IN走索引技术(in走索引 oracle)
- 使用Oracle中的IN条件实现复杂查询(oracle中in条件)
- 使用cx_freeze把python打包exe示例