如何在同一行上打印tqdm进度栏?

时间:2019-03-25 09:53:21

标签: python eclipse tqdm

我试图在我的for循环中放置一个进度条,但是每次迭代后进度条都移到下一行。 如何将其放在一行中? 我正在使用eclipse,代码如下:

from selenium import webdriver
import time
import os
import datetime
from tqdm import trange


i=0
for i in trange(b):
    day = driver.find_elements_by_xpath('//*[@id="aaaaa"]/div/table[2]/tbody/tr/td[@style="background-color: rgb(204, 204, 0); color: rgb(128, 0, 0);"]')
    day[i].click()

    time.sleep(2)

    download = driver.find_element_by_xpath('//*[@id="content1"]/div/div[4]/div/div/table/tbody/tr[2]/td[2]/a[2]')
    download.click()

    driver.get('https://npp.gov.in/dgrReports') 

    pre_month = driver.find_element_by_xpath('//*[@id="aaaaa"]/div/table[1]/tbody/tr/td[1]')
    pre_month.click()    


1 个答案:

答案 0 :(得分:1)

问题出在 Eclipse 控制台上。这些步骤对我有用:

在 Eclipse 中,

  • 转到Window -> Preferences
  • 展开 Run/Debug,然后选择 Console
  • 在右侧,启用 Interpret ASCII control characters

Eclipse Console Preferences with Interpret ASCII control characters option enabled