Python代码在Jupyter笔记本中不起作用
我正在构建一个代码来下载一些数据并重命名文件。当我在Jupyter笔记本中通过在单独的单元格中运行A部分和B部分来测试它时,它可以工作,但在单个单元格中同时运行时它不工作 A部分Python代码在Jupyter笔记本中不起作用,python,Python,我正在构建一个代码来下载一些数据并重命名文件。当我在Jupyter笔记本中通过在单独的单元格中运行A部分和B部分来测试它时,它可以工作,但在单个单元格中同时运行时它不工作 A部分 driver.find_element_by_xpath("//input[@value='Submit & Clear History']").click() time_to_wait = 10 time_counter = 0 while not os.path.exists(r"C:\Users\rkma
driver.find_element_by_xpath("//input[@value='Submit & Clear History']").click()
time_to_wait = 10
time_counter = 0
while not os.path.exists(r"C:\Users\rkmaheshwaran\Downloads\CSV\Py-files"):
time.sleep(1)
time_counter += 1
if time_counter > time_to_wait:break
print("done")
乙部
os.chdir(r"C:\Users\rkmaheshwaran\Downloads\CSV\Py-files")
for file in os.listdir(r"C:\Users\rkmaheshwaran\Downloads\CSV\Py-files"):
src=file
if src=='printcsvreports.csv':
dst="inflowdata-" + time.strftime("%Y%m%d") + ".csv"
os.rename(src,dst)
print("renamed")
错误消息具体说明了什么?我没有收到任何错误消息,但是在一起运行这些代码时文件没有重命名。获得的输出为:done