I am trying to create a code that takes number from output and create a generate a text file with that number , then write some lines in that file with that number in use ..
I tried to use the code :
for i in Nums:
sh1 = '%d.txt' %i
target = open (sh1, 'w') ## a will append, w will over-write
text = '%d * 0\n %d *1'
target.write(text %(i))
target.close()
but i face this error TypeError: not enough arguments for format string . I do not understand this error why shows for me . I searched but solutions did not work with my code .
What i need from the code is to create the text file Like if i entered the number 1 . creates txt file name 1.txt and write these lines to it .
1 * 0
1 * 1
1 * 2
1 * 3
Any help ? Thanks in advance