How to save received data to file?

Where you are over to take 2 numbers written with a space from a file, write their sum in another file
Fin = open ( "input.txt" ) 
Fout = open ( "output.txt", "w" ) 
str = Fin.readline().split() 
x, y = int(str[0]), int(str[1]) 
a = x + y 
Fout.write(a) 
Fout.close() 
Fin.close()

Error
Traceback (most recent call last):
File "C:\Python26\test.txt", line 6, in
Fout.write(a)
TypeError: argument 1 must be string or read-only character buffer, not int
I understand that the solution is probably very simple, but I don't know what to do, where is the error, I kind of understand that you need to transfer int to str but it does not work
April 3rd 20 at 17:38
1 answer
April 3rd 20 at 17:40
Solution
Try
Fout.write("%s" % a)

Find more questions by tags Python