Skip to Content
Learn Python by Building Data Science Applications
book

Learn Python by Building Data Science Applications

by Philipp Kats, David Katz
August 2019
Beginner
482 pages
12h 56m
English
Packt Publishing
Content preview from Learn Python by Building Data Science Applications

dir

When run, dir will return all the corresponding values and methods, connected to the given object, as an array of strings. This is a convenient way to drill down and investigate all the methods and values of the particular variable:

>>> dir('Hello world')['__add__', '__class__', '__contains__', '__delattr__', '__dir__',... 'rsplit', 'rstrip', 'split', 'splitlines', 'startswith', 'strip', 'swapcase', 'title', 'translate', 'upper', 'zfill']

We removed some lines in order to save some space in the book in the preceding code. Feel free to execute that function yourself. As you can see, the list includes all the methods we described in the previous chapter—including title, upper, and zfill, and many others besides.

Let's now take a look at ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Python for Data Science

Python for Data Science

Yuli Vasiliev
Introduction to Machine Learning with Python

Introduction to Machine Learning with Python

Andreas C. Müller, Sarah Guido

Publisher Resources

ISBN: 9781789535365Supplemental Content