Am trying to loop through a range of variables and write them to output files on new lines.
I have researched and tried f.write, print(), printf, and f'.
Code is returning frequent syntax error or i am passing too many arguments or cannot concatenate strings and integers.
House = range(0,40,10) .
LOOP THROUGH EACH VARIATION:
casenumber = 0 #used in the filename for ham in House: # CREATE INDIVIDUAL YML (TEXT) FILES casenumber = casenumber + 1 filename = 'Case%.3d.yml' % casenumber f = open(filename, 'w') # The content of the file: f.write('My House has this many cans of spam', House) f.close()