19
2020
04

import requests and BeautifulSoup

import requestsfrom bs4 import BeautifulSoupurl = 'https://xxxxxxxxx'page = requests.get(url)page.text soup = BeautifulSoup(page.text, 'html.parser')print(soup.prettify())soup.find_all('p')soup.find_all('p')[2].get_tex
18
2020
04

python crawler

from selenium import webdriverdriver=webdriver.Chrome("xxx location")driver.get("http://xxxxxxxx") driver.page_sourcefrom bs4 import BeautifulSoupsoup = BeautifulSoup(driver.page_source,  'lxml')soup.select_one('#
21
2020
03

Firefox driver for python selenium

https://stackoverflow.com/questions/26070834/how-to-fix-selenium-webdriverexception-the-browser-appears-to-have-exited-beforsudo apt-get install xvfbsudo pip install pyvirtualdisplay#!/usr/bin/env pythonfrom pyvirtualdisplay import Displayfrom seleni
14
2020
03

Python random number

import randomprint("Printing random float number with two decimal places is ", round(random.random(), 1))print("Random float number between 36.4 and 36.9 with two decimal places is ", round(random.uniform(36.4,36.9), 1))
21
2020
02

Turn your Android smartphone into a Linux web server

http://prochal.com/2017/09/turn-android-smartphone-linux-web-server-part-2/Installing LAMPFirst, make sure you’re logged as root. If you set the user to root in the previous step, most likely you would. If not, elevate user privileges by adding ‘sudo