python - How to write two variables in one line? -
this question has answer here:
- print multiple arguments in python 9 answers
- python: how write multiple strings in 1 line? 4 answers
i write 2 variable in file. mean code :
file.write("a = %g\n" %(params[0])) file.write("b = %g\n" %(params[1])) and want write in file :
f(x) = ax + b where a params[0] , b params[1] don't know how ?
thank !
"f(x) = {a}x + {b}".format(a=params[0], b=params[1]) is clean solution
Comments
Post a Comment