How do you sort a list by the second (or nth) element on in Python? How can you leave the first or nth elements in a list as they are but then have the remaining elements in the list sorted? When applying the .sort() list method on a list Python … [Read more...] about Python: Sort List From Second (or Nth Index) On
Python is a great language to get started with and one that you can operational with quite quickly, especially if you have to deal with data in your line of work.
I have been able to use Python to help wrangle through CSV files, fetch data remotely from the web using the famous requests library, and do some database operations.
Python has a REPL feature that can help you tinker with the code and quickly test the syntax as you learn. There are many helpful resources, and some of the posts below are things I've learned (and am still learning!) along the way, hopefully they can help assist you in your journey too.
There have been times when after creating a list in Python I've wanted to sort a list and then have the list reversed from ascending to descending. To reverse the order of a list in Python use either the .reverse() list method which mutates the … [Read more...] about Reverse Order Of List In Python Without For Loops (Examples, One-Liners, No Imports)
In Microsoft Word you can control whether or not you want to see the white space characters in your document. This helps to check you haven't incorrectly inserted a tab where a space should have gone and vice versa. Generally, a tab is the same … [Read more...] about How Many Spaces Is A Tab: 2, 3, 4 or 5?
There are three main ways within Python on how to remove specific characters from a string in Python, and I've clustered these approaches based on the following methods: Built-in string methodsBy patternBy position Each approach has its own … [Read more...] about How To Remove Characters From A String In Python (Examples, No Imports)