Advertisement
Guest User

LogFile XML

a guest
Feb 24th, 2020
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.44 KB | None | 0 0
  1. # -*- coding: utf-8 -*-
  2.  
  3. from bs4 import BeautifulSoup as bs
  4.  
  5. content = []
  6.  
  7. with open("test.xml") as testFile:
  8.     # można to zrobić prościej
  9.     bs_content = bs(testFile, "xml")
  10.     print(bs_content)
  11.     # jeśli nie wierz co to lambda, polecam poczytać
  12.     test1 = bs_content.find_all(lambda tag: tag.name == "Content" and "Wartość" in tag.get_text())
  13.     print (test1)
  14.     # teraz wystarczy wyciągnąć liczbę z tagów Content
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement