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

How to understand 2 main() functions after using uftrace to profile the C++ program? -

c# - Update a combobox from a presenter (MVP) -

How to put a lock and transaction on table using spring 4 or above using jdbcTemplate and annotations like @Transactional? -