Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
xml extract currency
#6
For me the standard way(for a long time) is to use BS(with lxml as parser for speed) or lxml alone.
Of course if new to this then may use stuff from standard library first,just to show that there other option for this.
from bs4 import BeautifulSoup

soup = BeautifulSoup(xml_data, 'lxml-xml')
multi = soup.find_all('Rate', {'multiplier': True})
for item in multi:
    print(item.attrs.get('currency'))
Output:
HUF JPY KRW
3lnyn0 likes this post
Reply


Messages In This Thread
xml extract currency - by 3lnyn0 - Apr-30-2022, 07:21 AM
RE: xml extract currency - by ndc85430 - Apr-30-2022, 07:32 AM
RE: xml extract currency - by 3lnyn0 - Apr-30-2022, 07:40 AM
RE: xml extract currency - by ndc85430 - Apr-30-2022, 07:54 AM
RE: xml extract currency - by 3lnyn0 - Apr-30-2022, 08:31 AM
RE: xml extract currency - by snippsat - Apr-30-2022, 10:29 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  currency converter using forex-python preethy12ka4 8 842 Mar-08-2024, 06:59 PM
Last Post: preethy12ka4
  Currency converter Scott 5 3,088 Jun-14-2020, 11:59 PM
Last Post: Scott
  Currency formatting the third element in a 2D list RedSkeleton007 3 3,241 Mar-09-2018, 12:53 PM
Last Post: j.crater
  rounding locale.currency birdieman 8 10,687 Dec-28-2016, 01:48 AM
Last Post: birdieman

Forum Jump:

User Panel Messages

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