Python Forum
BeautifulTable print header multi times
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
BeautifulTable print header multi times
#1
hello all im trying to code a tool to check the status for all websites in server IP : code :
# encoding=utf8
import sys
reload(sys)
sys.setdefaultencoding('utf8')
import requests as qan
import time 
from beautifultable import BeautifulTable
import warnings


warnings.filterwarnings('ignore', message='Unverified HTTPS request')
table = BeautifulTable()

def readfile():
    
    with open('/root/domain.txt') as fp:
        
        for line in fp:
            http = "http://" + line.rstrip()
            u = qan.get(http ,verify= False)
            u = (str(u.status_code))
            table.column_headers =["Website", "Status", "Time"]
            table.column_alignments['Website'] = BeautifulTable.ALIGN_LEFT
            table.set_style(BeautifulTable.STYLE_MARKDOWN)
            
            table.append_row([http, u, str(time.clock()) ])
            
            print(table)
            #print(http + " \t\t\t== > Status : " + u + " \t took : " + str(time.clock()) )
readfile()
when i runt it i got this result :
[Image: Screenshot-from-2019-10-28-01-40-38.png]
its print the table header multi times i need to print it just one time how i can do that ??
Reply


Messages In This Thread
BeautifulTable print header multi times - by evilcode1 - Oct-27-2019, 11:54 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How to print string multiple times on new line ace19887 7 5,841 Sep-30-2020, 02:53 PM
Last Post: buran
  How to print string multiple times separated by delimiter Mekala 1 1,947 May-23-2020, 09:21 AM
Last Post: Yoriz
  Print 'X' a number of times Than999 1 2,683 Jan-18-2020, 06:41 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020