How-to articles, tricks, and solutions about PYTHON
How do I split a string into a list of characters?
In Python, you can use the built-in list() function to convert a string into a list of characters.
How do I access the ith column of a NumPy multidimensional array?
You can access the ith column of a NumPy multidimensional array by using the following syntax:
Split string on whitespace in Python
You can use the split() method to split a string on whitespace in Python.
How do I read CSV data into a record array in NumPy?
You can use the numpy.genfromtxt() function to read CSV data into a NumPy record array.
Python string.replace regular expression
You can use the re module in Python to use regular expressions with the replace() method.
Changing one character in a string
Here is a code snippet that demonstrates how to change a single character in a string in Python:
Adding a legend to PyPlot in Matplotlib in the simplest manner possible
Here is a simple code snippet that demonstrates how to add a legend to a PyPlot in Matplotlib:
How to uninstall Python 2.7 on a Mac OS X 10.6.4?
To uninstall Python 2.7 on a Mac OS X 10.6.4, you can use the following commands in the terminal:
Writing string to a file on a new line every time
Here is an example code snippet for writing a string to a file on a new line every time in Python:
Python 3: UnboundLocalError: local variable referenced before assignment
This error occurs when you are trying to access a variable before it has been assigned a value.
ImportError: No module named PIL
Here is a code snippet that demonstrates how to catch the "ImportError: No module named PIL" error: