Advertisement
TorroesPrime

Untitled

Sep 27th, 2023 (edited)
872
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.49 KB | Software | 0 0
  1. from bs4 import BeautifulSoup
  2. src = open("source.txt",'r',encoding="UTF-8")
  3. content = BeautifulSoup(src, "lxml")
  4. table = content.find(name="table")
  5. data = []
  6. for row in table.find_all(name="tr"):
  7.     row_data = []
  8.     for cell in row.find_all(name="td"):
  9.         datastr = str(cell.text)
  10.         datastr.replace("\n","")
  11.         datastr.replace("\t","")
  12.         datastr.strip()
  13.         for char in datastr:
  14.             if char == "\t":
  15.                 print("tab")
  16.         print(datastr)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement