1. Python 2.7
The write method of file object can only accept py2.7 str type object as the argument, unicode type object is not accepted !
Conversely, the write method of file object created by codecs module only accept py2.7 unicode object as the argument.
2. Python2.7
The unicode function in py27 requires a encoding parameter to be given in order to convert a non-ASCII string ( 8-bit string) into a py27 unicode string.
If no encoding is given, the unicode function can only work on 8-bit strings.