I\'m currently porting a Python2 script to Python3 and have problems with this line:
print(\'\\xfe\')
When I run it with Python2 pyth
The print(argument) converts the argument using str() (if neccessary) and then it calls file.write(string). The file is the optional argument of the print(), and it defaults to sys.stdout. It means that you should be able to do the same with sys.stdout.write(str(argument) + '\n'). So, the result depends on the used encoding that you can get from sys.stdout.encoding. If you pass another file argument, then the file object have to be open for writing in the text mode, and possibly a different encoding may be applied.