How-to articles, tricks, and solutions about PYTHON-3.X
Best way to convert string to bytes in Python 3?
In Python 3, you can convert a string to bytes using the bytes function.
error UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte
Here is an example of how to handle a UnicodeDecodeError caused by an invalid start byte:
How can I flush the output of the print function?
To flush the output of the print function, you can use the flush parameter of the print function.
How do I upgrade the Python installation in Windows 10?
To upgrade the Python installation in Windows 10, you can use the pip package manager.
How do I use raw_input in Python 3?
In Python 3, the input() function can be used in place of raw_input() to read input from the user.
Import error: No module name urllib2
It looks like you are trying to import the urllib2 module, which is not available in Python 3.
List attributes of an object
In Python, you can use the built-in function dir() to list the attributes of an object.
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.