import pyaudio
import audioop
import math
CHUNK = 1024
FORMAT = pyaudio.paInt16
CHANNELS = 2
RATE = 44100
RECORD_SECONDS = 1
p = pyaudio.PyAudio()
stream = p.open(format=FORMAT,
channels=CHANNELS,
rate=RATE,
input=True,
frames_per_buffer=CHUNK)
for i in range(0, int(RATE / CHUNK * RECORD_SECONDS)):
data = stream.read(CHUNK,
exception_on_overflow=False)
rms = audioop.rms(data, 2)
decibel = 20 * math.log10(rms)
print(decibel)
stream.stop_stream()
stream.close()
p.terminate()
from lxml import etree
from io import StringIO
import requests
parser = etree.HTMLParser()
page = requests.get('https://URL.COM')
html = page.content.decode("utf-8")
tree = etree.parse(StringIO(html), parser=parser)
def get_links(tree):
refs = tree.xpath("//*")
links = [link.get('src', '') for link in refs]
return [l for l in links if l.startswith('https://')]
links = get_links(tree)
['https://vkvd28.mycdn.me/?srcIp=35.174.13.217&expir...', 'https://vkvd28.mycdn.me/?srcIp=35.174.13.217&expir...', 'https://vkvd28.mycdn.me/?srcIp=35.174.13.217&expir...', 'https://i.mycdn.me/getVideoPreview?id=120288811684...']
# Python 3
import ctypes
ctypes.windll.user32.ShowWindow( ctypes.windll.kernel32.GetConsoleWindow(), 6 )
import ctypes
notepad_handle = ctypes.windll.user32.FindWindowW(None, "Untitled - Notepad")
ctypes.windll.user32.ShowWindow(notepad_handle, 6)
notepad_handle = ctypes.windll.user32.FindWindowW(u"Notepad", None)
ctypes.windll.user32.ShowWindow(notepad_handle, 6)
https://code.visualstudio.com/docs/python/python-t...
https://matplotlib.org/stable/tutorials/introducto...
top = driver.find_element_by_id("/html/body")
all_childs_by_xpath = top.find_elements_by_xpath(".//*")
for e in all_childs_by_xpath:
e.get_attribute('class')