Giving life-long learners a low-stress way to hone their #Python skills. 🐍🍪 Write beautiful code. ✨ Made by @treyhunner 💖pythonmorsels.comJoined January 2018
You'll almost always see tuple unpacking used whenever enumerate is used.
for n, fruit in enumerate(favorite_fruits, start=1):
print(n, fruit)
#Pythonpym.dev/looping-with-i…
You don't need third-party libraries to read CSV files in #Python! Python's csv module includes helper functions for reading CSV files, tab-delimited files, and other delimited data files. 👀💻🔍
pym.dev/csv-reading/?u…
"When we loop over a csv.reader object, the reader will loop over the file object that we originally gave it and convert each line in our file to a list of strings." 🔄💱 #Pythonpym.dev/csv-reading/?u…
"For a very simple command-line program, you could just rely on #Python to close the file automatically when your Python program exits."
youtube.com/watch?index=1&…
If we want to start counting at a different number, we can set the start keyword argument when calling enumerate.
for n, fruit in enumerate(favorite_fruits, start=1):
print(n, fruit)
#Pythonpym.dev/looping-with-i…
"If you'd prefer to think in terms of the headers in your file, rather than in terms of the indexes of each data column, you could use csv.DictReader instead of csv.reader." 📚 #Pythonpym.dev/csv-reading/?u…
"Just like with reader objects, we can loop over DictReader objects to get the rows within our file. But unlike reader objects, instead of getting back lists representing each row, we'll get back dictionaries." #Pythonpym.dev/csv-reading/?u…
9K Followers 730 FollowingConstantly looking for simple ways to explain complex things You'll find: • Python • Narrative Technical Writing • Track & Field Athletics—Links in pinned post
28K Followers 1K FollowingAuthor of "Automate the Boring Stuff with Python" and other programming books. This account is just promo stuff now, follow me on Mastodon. he/him
10K Followers 1K FollowingEngineering Coach https://t.co/ABlKqevhcW | Python • Rust • AI | Building the engineering judgment AI can’t replace. Co-founder of @Pybites.
1 Followers 56 FollowingBeginner Python learner building projects and learning by doing. Sharing my journey, progress, and lessons as I grow step by step.
172 Followers 3K FollowingMy only goal is to get my wife to follow me organically being equal parts awesome & asshat. & comics. I like comics.
🇺🇸 First / Lifelong Patriot / Cypherpunk
93 Followers 369 FollowingBitblender-volleyballcoach-antarctic-husband-dad Disclaimer: Subjects Are Not Necessarily In The Right Order Of Importance!!!
692K Followers 126 FollowingThe nonprofit organization behind the Python programming language. For help with Python code: https://t.co/XDHPttz2Xv
On Mastodon: @[email protected]