I want to generate hundreds of file paths in python and save them into an excel file. Each path should save in a separate row and paths vary just by one value. I am not sure how to iterate it through a for loop.
Here is my try:
import xlsxwriter
workbook = xlsxwriter.Workbook('hello.xlsx')
worksheet = workbook.add_worksheet()
for i in range (4):
worksheet.write('A%d', '/home/exx/Documents/Input/%d/2.mp4', %(i)))
workbook.close()
Output is excel file should be like below:
/home/exx/Documents/Input/0/2.mp4
/home/exx/Documents/Input/1/2.mp4
/home/exx/Documents/Input/2/2.mp4
/home/exx/Documents/Input/3/2.mp4
'/home/exx/Documents/Input/%d/2.mp4' % (i)orf'/home/exx/Documents/Input/{i}/2.mp4'for the path string part. EDIT: To make it more clear, remove the comma before% (i).