Title is pretty self-explanatory. Currently I have:
with open('dwarf_fort.txt') as f:
for minerals in f:
mining_rig()
I need it to go from 'dwarf_fort.txt', execute the program and append the output into a new file. What am I missing here? Thank you.
This should work:
with open('dwarf_fort.txt') as f, open('out_f.txt', mode='w') as f1:
for minerals in f:
f1.write(minerals)
If the output file is still blank, do some checks:
dwarf_fort.txt
is in the same directory as the .py script.dwarf_fort.txt
is not blankout_f.txt
that gets created can be written to)