python - How to write two variables in one line? -


this question has answer here:

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

Popular posts from this blog

javascript - Confirm a form & display message if form is valid with JQuery -

Retrieving ETA (estimated time of arrival) with Google Distance Matrix API and public transit as transport mode -

ionic framework - Meteor - Error: Failed to execute 'insertBefore' on 'Node' -