mirror of
https://github.com/bcomsugi/dasaproject.git
synced 2026-01-08 18:42:37 +07:00
24 lines
728 B
Python
24 lines
728 B
Python
import string
|
|
|
|
def get_alpha_numeric(text:str):
|
|
result=""
|
|
for x in text:
|
|
if x.isdecimal() or x.isalpha():
|
|
result += x
|
|
return result
|
|
|
|
|
|
def pprintXml(qbxml_query):
|
|
import xml.dom.minidom
|
|
from xml.sax.saxutils import escape
|
|
from lxml import etree
|
|
# dom = xml.dom.minidom.parse(xml_fname) # or
|
|
if isinstance(qbxml_query, str):
|
|
dom = xml.dom.minidom.parseString(qbxml_query)
|
|
pretty_xml_as_string = dom.toprettyxml(" ").split('\n')
|
|
pretty_xml_as_string = '\n'.join([s for s in pretty_xml_as_string if s.strip() ])
|
|
# print(f'pprintxml:\n{pretty_xml_as_string}')
|
|
return pretty_xml_as_string
|
|
|
|
if __name__ == "__main__":
|
|
print(get_alpha_numeric('TH-201/88. aa, BH')) |