
Python Morsels
@PythonMorsels
Giving life-long learners a low-stress way to hone their #Python skills. ๐๐ช Write beautiful code. โจ Made by @treyhunner ๐
Potrebbero piacerti
Python Morsels gives professional developers a low-stress way to hone their Python skills, through weekly screencasts and exercises. ๐๐ช It's not a course. And it's not for complete beginners. Try it out: pythonmorsels.com/all-python-exeโฆ More details ๐
pythonmorsels.com
Python skill-building for professional developers
Practice a new intermediate-level Python concept every week
Looking for an excuse to deepen your #Python skills? I made @PythonMorsels for you. It's not an Intro to Python course. It's both not a course & includes topics well beyond introductory Python. Don't think "tennis class". Think "weekly tennis practice". ๐พ But for Python! ๐
"A yield statement turns a regular function into a generator function." #Python pythonmorsels.com/what-is-a-geneโฆ
You'll almost always see tuple unpacking used whenever enumerate is used. for n, fruit in enumerate(favorite_fruits, start=1): print(n, fruit) #Python pym.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 call this generator function, it doesn't actually run the code in that function!" ๐คฏ #Python youtube.com/watch?utm_campโฆ
youtube.com
YouTube
How to create a generator function in Python
"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." ๐๐ฑ #Python pym.dev/csv-reading/?uโฆ
"We can only tell it's a generator function by the presence of a yield statement." #Python pythonmorsels.com/what-is-a-geneโฆ
"Creating a singleton class might seem a little bit misleading to someone using this class." ๐ #Python youtube.com/watch?utm_campโฆ
youtube.com
YouTube
Making singletons in Python
"Note that csv.reader doesn't know or care about the headers in our file: it treats every row equally." #Python pym.dev/csv-reading/?uโฆ
"The yield statement is what turns a function into a generator function." ๐ป #Python youtube.com/watch?utm_campโฆ
youtube.com
YouTube
How to create a generator function in Python
"We've exhausted our generator object; we've fully consumed all the items within it." ๐ #Python youtube.com/watch?utm_campโฆ
youtube.com
YouTube
How to create a generator function in Python
"Unlike lists, generator objects don't have a length" #Python pythonmorsels.com/how-write-geneโฆ
If something is important, it deserves a name. #Python's for loops names the items themselves, not indexes. pythonmorsels.com/writing-a-for-โฆ
"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&โฆ
youtube.com
YouTube
Read from a file in Python
"In #Python, you can customize what happens when you ask objects whether they're equal to each other." ๐๐ฐ pym.dev/overloading-eqโฆ
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) #Python pym.dev/looping-with-iโฆ
The built-in str function actually calls the __str__ method on the object that we give it. #Python youtube.com/watch?utm_campโฆ
youtube.com
YouTube
Customizing the string representation of your Python objects
"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." ๐ #Python pym.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." #Python pym.dev/csv-reading/?uโฆ
"A singleton class is a class that only allows creating one instance of itself." 1๏ธโฃ #Python youtube.com/watch?utm_campโฆ
youtube.com
YouTube
Making singletons in Python
"Turn a regular function into a generator function by replacing append calls with yield statements." ๐ #Python pym.dev/how-to-create-โฆ
United States Tendenze
- 1. Yamamoto 49.3K posts
- 2. #DWTS 45K posts
- 3. Young Republicans 79.3K posts
- 4. halsey 9,513 posts
- 5. #MOST_WANTED_IN_CHICAGO 1,484 posts
- 6. #FlyTogether 3,005 posts
- 7. Kreider 1,365 posts
- 8. #Worlds2025 48.6K posts
- 9. #TexasHockey 3,464 posts
- 10. Jared Butler N/A
- 11. Ohtani 14.4K posts
- 12. Lucia 62.9K posts
- 13. Cuffem 3,044 posts
- 14. Tami 4,684 posts
- 15. TOKYO NARITA N/A
- 16. Vivian 29.8K posts
- 17. Robert 107K posts
- 18. Will Richard 2,632 posts
- 19. George Floyd 35.3K posts
- 20. Vishnu 9,176 posts
Potrebbero piacerti
-
Trey Hunner
@treyhunner -
Mike Driscoll
@driscollis -
Talk Python Podcast
@TalkPython -
Mouse Vs Python
@mousevspython -
Real Python
@realpython -
PyCoderโs Weekly
@pycoders -
Pybites
@pybites -
TestDriven.io
@testdrivenio -
Michael Kennedy
@mkennedy -
Daily Python Tip ๐๐ง
@python_tip -
Python Visual Studio Code
@pythonvscode -
Bob Belderbos
@bbelderbos -
Python Package Index
@pypi -
Matt Harrison
@__mharrison__ -
Patrick Loeber
@patloeber
Something went wrong.
Something went wrong.