support python3 by making the print statement to a function

I wanted to use your nice program in python3, but there was an error. Therefore I made this pull request for python3 support. the following is the explanation of commit. 

In python2, print is a statement so the following code is valid:
  print what,

But in python3, print is a function rather than a statement, so the code
have to be like the following:
  print(what, end=' ')

This code is invalid in python2, but the __future__ module deals this
well fortunately.