[Python Tips] Getting Help
programming·@themarkymark·
0.000 HBD[Python Tips] Getting Help
 There are a few handy functions built into Python to help the developer get more information about an object. # help() If you want to get the documentation on an object or function you can use the help() function to look up any documentation available. ``` > help(id) Help on built-in function id in module builtins: >>> id(obj, /) Return the identity of an object. This is guaranteed to be unique among simultaneously existing objects. (CPython uses the object's memory address.) ``` This is only useful when using python interactively via **repl** or [bpython](https://steemit.com/programming/@themarkymark/python-tips-a-better-interactive-shell). # dir() When you call dir() without any arguments, it will return the names of everything in scope. ``` >>> dir() ['__builtins__', '__doc__', '__name__', 'help'] >>> a = 5 >>> dir() ['__builtins__', '__doc__', '__name__', 'a', 'help'] ``` If you call dir on an object, it will return all the available attributes. ``` >>> a = 'Hello World' >>> dir(a) ['__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'] ``` dir() is also most useful when using python interactively. While both of these functions are not typically used on a daily basis, knowing they are available can be helpful when working interactively. I typically work interactively when doing querying or working with objects I don't understand yet to get a feel for how they work. This is where [bypython](https://steemit.com/programming/@themarkymark/python-tips-a-better-interactive-shell) shines. As always, the [Python Online Docs](https://docs.python.org/3/) is a great reference when trying to understand how the built-in functions and objects work. They can be difficult to understand to new programmers and just doing a Google search for what you need help with and then clicking videos usually yields the best results. Almost every topic has been covered in detail in a YouTube video. # Good Python YouTubers I highly recommend. * [Sentdex](https://www.youtube.com/user/sentdex) * [Dan Bader](https://www.youtube.com/channel/UCI0vQvr9aFn27yR6Ej6n5UA) * [Data School (Kevin Markham)](https://www.youtube.com/channel/UCnVzApLJE2ljPZSeQylSEyg) * [Derek Banas](https://www.youtube.com/user/derekbanas/featured) If you haven't already, consider opening an account on [StackOverflow](https://stackoverflow.com) the most popular Q&A site for developers across the world. # My Python Tips Series * [f-strings in Python 3.6](https://steemit.com/programming/@themarkymark/python-tips-f-strings-in-python-3-6-and-why-you-should-be-using-them) * [Underscores in numeric literals](https://steemit.com/programming/@themarkymark/python-tips-underscores-in-numeric-literals) * [A better interactive shell](https://steemit.com/programming/@themarkymark/python-tips-a-better-interactive-shell) * [Secrets Module - New in 3.6](https://steemit.com/programming/@themarkymark/python-tips-secrets-module-new-in-3-6) * [PEP 8](https://steemit.com/programming/@themarkymark/python-tips-pep-8) * [Slices](https://steemit.com/programming/@themarkymark/python-tips-slices) * [Named Tuples](https://steemit.com/programming/@themarkymark/python-tips-named-tuples) * [Destructuring](https://steemit.com/programming/@themarkymark/python-tips-destructuring) * [Counter](https://steemit.com/programming/@themarkymark/python-tips-counter) * [Type Annotation](https://steemit.com/programming/@themarkymark/python-tips-type-annotation) * [Jupyter Notebooks](https://steemit.com/programming/@themarkymark/python-tips-jupyter-notebooks) <center><sub><sub> X48EJ </sub></sub></center> # <center> [Why you should vote me as witness](https://steemit.com/witness-category/@themarkymark/why-you-should-vote-for-themarkymark-as-witness) </center> # <center>https://steemitimages.com/DQmcWxV1dpA1eAtw2ipwZiWZkydyVNU5LaLa2Ak1GUnbGmS/The-Marky-Mark.png </center> # <center> Witness & Administrator of four full nodes </center> #  </br> # <center> My recent popular posts </center> # [STEEM, STEEM Power, Vests, and Steem Dollars. wtf is this shit?](https://steemit.com/steem/@themarkymark/steem-steem-power-vests-and-steem-dollars-wtf-is-this-shit) [The truth and lies about 25% curation, why what you know is FAKE NEWS](https://steemit.com/curation/@themarkymark/the-truth-and-lies-about-25-curation-why-what-you-know-is-fake-news) [WTF is a hardware wallet, and why should you have one?](https://steemit.com/bitcoin/@themarkymark/wtf-is-a-hardware-wallet-and-why-should-you-have-one) [GINABOT - The Secret to your Sanity on Steemit](https://steemit.com/ginabot/@themarkymark/ginabot-the-secret-to-your-sanity-on-steemit) [How to calculate post rewards](https://steemit.com/steemit/@themarkymark/how-to-calculate-post-rewards) [Use SSH all the time? Time for a big boy SSH Client](https://steemit.com/linux/@themarkymark/use-ssh-all-the-time-time-for-a-big-boy-ssh-client) [How to change your recovery account](https://steemit.com/steemit/@themarkymark/how-to-change-your-recovery-account) [How curation rewards work and how to be a kick ass curator](https://steemit.com/curation/@themarkymark/how-curation-rewards-work-and-how-to-be-a-kick-ass-curator) [Markdown 101 - How to make kick ass posts on Steemit](https://steemit.com/steemit/@themarkymark/markdown-101-how-to-make-kick-ass-posts-on-steemit) [Work ON your business, not in your business! - How to succeed as a small business](https://steemit.com/business/@themarkymark/work-on-your-business-not-in-your-business-how-to-succeed-as-a-small-business) [You are not entitled to an audience, you need to earn it!](https://steemit.com/steemit/@themarkymark/you-are-not-entitled-to-an-audience-you-need-to-earn-it) [How to properly setup SSH Key Authentication - If you are logging into your server with root, you are doing it wrong!](https://steemit.com/sysadmin/@themarkymark/how-to-properly-setup-ssh-key-authentication-if-you-are-logging-into-your-server-with-root-you-are-doing-it-wrong) [Building a Portable Game Console](https://steemit.com/raspberrypi/@themarkymark/building-a-portable-game-console) [](https://v2.steemconnect.com/sign/account-witness-vote?witness=themarkymark&approve=1)
👍 doverun, ipromote, nightdragon, kelvo, wave.beads, unmesh, nota69, makerhacks, resteem.bot, nelkeljdm, yachtdesigner, china-mobile, kryptogermany, samuelhull, upvoting-bot, shweyaungmyanmar, bikerkiddo, tuts, khusi, assetminds, finanzamt, kujtim05, xmrking, novacadian, synergysteem, sanja-cash, kenistyles, cryptogem, amico, igienistamentale, drekkelly, demartini, freebornsociety, hairshares, natsch, gtmatze, voaputra, oyundelisi, bigboy9, dieterhubert, erarnitox, luli1, anyx, kushed, steemychicken1, aizensou, b0y2k, stoner19, igl00, hagie, coinbar, platinum-blue, bigdaddy, kingsmind, papadimos, romedog, spg, trumpman, sammosk, dream-o, reviewsatrandom, memesplease, tushy, ozchartart, berniesanders, z8teyb289qav9z, nextgencrypto, steemservices, richman, razvanelulmarin, knozaki2015, shawnamawna, caesarion, thebluepanda, yoshiko, thisisbenbrick, sirwinchester, einsteinpotsdam, zahnspange, thecyclist, steemsquad, allesgruen, dannystravels, jerryblanceton, ssekulji, timbernana, sherlockcupid, dark.horse, toyman, engagement, i-gordan, iflagtrash, yougotflagged, buzzbeergeek, dolphinstudios, sunshinetraveler, freefuture, kinakomochi, arbitrarykitten, biancajapan, thedelegator, horsepower, teneiced, sumayyahsaidso, ngc, linkyourlife, teslaman, blondephysics, dadview, adventureevryday, steemitcitizen, simplifylife, kriptonoob, andrekweku, patricklancaster, kwekuabeiku, stone1, frankyfrank10, chickenfucker, pharesim, digitaldreamer, derrick829, playfulfoodie, cryptokeepr, investfourmore, kessielynbote, konelectric, steemitlotteries, germanaure, steemcenterwiki, solascriptura, donnjoez, renulia, thecreativerebel, alexzicky, yulem, epixar, thecryptodrive, shahab3211, lazzelazer, nicnas, blerdrage, purepinay, saqibnazir, torico, judasp, drmincu, achrafo, suntree, votebott, isnochys, erodedthoughts, bue, amos811, cyber-smiley, az88822, tymba, magnat, izge, steemernoob, denisechips, topkpop, steemusa, jvhteach, zeddjacob, jvhplays, kiddarko, krazypoet, gregjava, nurhasib, noobsin, bysteem, mstafford, c0wtschpotato, vintageverve, tonyelvis, tianyarenxing, xr-hammergaming, andreasgrubhofer, jejangkit, intelliguy, drags, orangeflash81, altafalazzam, diogogomes, febrirmd, privacybydesign, dkmathstats, prlndra, skorpsim, wonderwomancodes, thoughtfulonion, busy.pay, pynchon, bitfly,