0
import base64
image_base64 = 'Hello World\n'
print image_base64    
print 'Hello?\n'

Result:

Hello World    
Hello?    
Hello World    
Hello?
3
  • 3
    I can't reproduce this at all... Commented Aug 13, 2016 at 1:03
  • 1
    Wait, is your file named base64.py and you're somehow doing a recursive import? Commented Aug 13, 2016 at 1:04
  • @Suever: You should add that as an answer. Commented Aug 13, 2016 at 1:05

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.