You can detect your operating system in Python using either os.name, sys.platform, or platform.system().| www.pythonmorsels.com
Python's strings have methods for checking whether a string starts or ends with specific text and for removing prefixes and suffixes.| www.pythonmorsels.com
Functions in Python can be defined within another function.| www.pythonmorsels.com
Python allows us to represent newlines in strings using the \n "escape sequence" and Python uses line ending normalization when reading and writing with files.| www.pythonmorsels.com
Need to loop over two (or more) iterables at the same time? Don't use range. Don't use enumerate. Use the built-in zip function. As you loop over zip you'll get the n-th item from each iterable.| www.pythonmorsels.com
Sequences are iterables that have a length. Sequences are ordered collections (they maintain the order of their contents). The most common sequences built-in to Python are string, tuple, and list.| www.pythonmorsels.com
Context managers power Python's with blocks. They sandwich a code block between enter code and exit code. They're most often used for reusing common cleanup/teardown functionality.| www.pythonmorsels.com
Need to represent multiple lines of text in Python? Use Python's multi-line string syntax!| www.pythonmorsels.com
If you need to make a very simple command-line interface and it doesn't need to be friendly, you can read sys.argv to manually process the arguments coming into your program.| www.pythonmorsels.com
Want to customize what "equality" means for your class instances in Python? Implement a __eq__ method! Make sure to return NotImplemented as appropriate though.| www.pythonmorsels.com