I am generating some numbers(lets say, num) and writing the numbers to output file using outf.write(num). But compiler is throwing an error:
outf.write(num).
Also you can use f-string formatting to write integer to file
For appending use following code, for writing once replace 'a' with 'w'.
for i in s_list: with open('path_to_file','a') as file: file.write(f'{i}\n') file.close()