Skip to content

Instantly share code, notes, and snippets.

View xsthunder's full-sized avatar
💪
working

xsthunder

💪
working
  • everywhere
View GitHub Profile
@xsthunder
xsthunder / split_and_counter_hitter.py
Created February 28, 2019 05:25
split string array by regex spliter, counter value frequency
import pandas as pd
def conlusion_hitter_df(arr):
conclusion_counter = {}
def per_item(ac, item):
v = item
if v not in ac:
ac[v] = 0
ac[v] = ac[v] + 1
return ac
conclusion_counter = reduce(per_item, arr, conclusion_counter)
@xsthunder
xsthunder / built_in_xml_reader.py
Created February 27, 2019 03:28
parse html or xml into dom
# see ()[https://stackoverflow.com/a/40749716]
from xml.dom.minidom import parseString
html_string = """
<!DOCTYPE html>
<html><head><title>title</title></head><body><p>test</p></body></html>
"""
# extract the text value of the document's <p> tag: