In Python 2 I used:
print \"a=%d,b=%d\" % (f(x,n),g(x,n))
I\'ve tried:
print(\"a=%d,b=%d\") % (f(x,n),g(x,n))
Simple Example:
print("foo %d, bar %d" % (1,2))
Other words printf absent in python... I'm surprised! Best code is
def printf(format, *args):
sys.stdout.write(format % args)
Because of this form allows not to print \n. All others no. That's why print is bad operator. And also you need write args in special form. There is no disadvantages in function above. It's a standard usual form of printf function.
A simpler one.
def printf(format, *values):
print(format % values )
Then:
printf("Hello, this is my name %s and my age %d", "Martin", 20)