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] Find available methods and help in REPL的更多相关文章

  1. Python笔记 #04# Methods

    源:DataCamp datacamp 的 DAILY PRACTICE  + 日常收集. Methods String Methods List Methods 缺一 Methods You can ...

  2. A Guide to Python's Magic Methods

    Book Source:[https://rszalski.github.io/magicmethods/] magic methods: 名称前后有双下划线的方法 构造函数和初始化 初始化类实例时, ...

  3. Python 的 Magic Methods 指南(转)

    介绍 本指南是数月博客的总结.主题是魔术方法. 什么是魔术方法呢?它们是面向对象Python语言中的一切.它们是你可以自定义并添加“魔法”到类中的特殊方法.它们被双下划线环绕(比如__init__或_ ...

  4. python的magic methods

    https://pycoders-weekly-chinese.readthedocs.io/en/latest/issue6/a-guide-to-pythons-magic-methods.htm ...

  5. Understanding Python metaclasses

    转载:https://blog.ionelmc.ro/2015/02/09/understanding-python-metaclasses/ None of the existing article ...

  6. fw:学好Python必读的几篇文章

    学好Python必读的几篇文章 from:http://blog.csdn.net/hzxhan/article/details/8555602 分类: python2013-01-30 11:52  ...

  7. Data manipulation primitives in R and Python

    Data manipulation primitives in R and Python Both R and Python are incredibly good tools to manipula ...

  8. 理解Python元类(转)

    add by zhj:先收藏了,有时间看,图倒是不少,可以配合stackover flow上那篇文章一起看 原文:http://blog.ionelmc.ro/2015/02/09/understan ...

  9. A few things to remember while coding in Python.

    A few things to remember while coding in Python. - 17 May 2012 - UPDATE: There has been much discuss ...

随机推荐

  1. FZOJ--2212--Super Mobile Charger(水题)

    Problem 2212 Super Mobile Charger Accept: 3    Submit: 11 Time Limit: 1000 mSec    Memory Limit : 32 ...

  2. reverse(两种反向生成url django原生形式和rest_framework中版本的形式)

    reverse(两种反向生成url django原生形式和rest_framework中版本的形式) views.py from django.shortcuts import render,Http ...

  3. 200 from memory cache / from disk cache / 304 Not Modified 区别

    三者情况有什么区别和联系,什么情况下会发生200 from memory cache 或 200 from disk cache 或 304 Not Modified? 200 from memory ...

  4. PostgreSQL 批量生成数据

    create table user_info(userid int,name text,birthday date,crt_time timestamp without time zone,); in ...

  5. UVa 11025 The broken pedometer【枚举子集】

    题意:给出一个矩阵,这个矩阵由n个数的二进制表示,p表示用p位二进制来表示的一个数 问最少用多少列就能将这n个数区分开 枚举子集,然后统计每一种子集用了多少列,维护一个最小值 b[i]==1代表的是选 ...

  6. 用@property (copy) NSMutableArray *array;会有什么问题?

    我们县回忆一下copy属性的作用,一个属性标记了copy,当你调用他的setter方法,他会建立一个索引计数为1的对象,然后释放旧对象. @property (copy) NSMutableArray ...

  7. UI Framework-1: UI Development Practices

    UI Development Practices Guidelines Principles for developing for Chrome. These best practices cente ...

  8. Chrome Foundation Services

    Chrome Foundation Services Contents Overview API Standards Service Directory Structure Dependencies ...

  9. vue之filter用法

    1.全局写法: 全局过滤器必须写在vue实例创建之前. Vue.filter('testfilter', function (value,text) { // 返回处理后的值 return value ...

  10. 用Python讲述冯绍峰和赵丽颖的爱情故事

    昨天刷头条时得知赵丽颖当妈妈了.作为一名程序员突发奇想,不如用Python简单叙述一下冯绍峰和赵丽颖的爱情故事,于是有了本文. 代码十分简单,适合编程小白和有一些Python基础的准程序员,其中用到了 ...