I have written a script in python3 that opens a website, logs into it, enter numbers by running through a list
list = [1,2,3,4,5,6,7,8,9,10,11]
for j in list:
enternum = driver.find_element_by_xpath('xxxx')
enternum.click()
enternum.send_keys(j)
and downloads a file after entering each number.
I want to rename the file the moment it is downloaded before downloading the next file. For example:- File downloaded for 1 will be renamed as 1, for 2 as 2 and so on. I have tried using shutil and os.rename but was not successful.
Is there a way I can do this using Python? Any help will be appreciated
I was able to change the file names after downloading them, by using os.path.join
and then using os.rename