import base64
image_base64 = 'Hello World\n'
print image_base64
print 'Hello?\n'
Result:
Hello World
Hello?
Hello World
Hello?
import base64
image_base64 = 'Hello World\n'
print image_base64
print 'Hello?\n'
Result:
Hello World
Hello?
Hello World
Hello?
Your file must be named base64.py
so when you import base64
at the top of the file, it is importing itself causing the print
statements to execute twice (once on the import and once afterwards).
You should rename your script to something whose name does not conflict with the name of a standard module.