What do you want to save?
Add Code snippet
New code examples
-
Python 2022-02-28 07:55:13
checking number of connected users hotspot ubuntu
#!/usr/bin/python3.6 import subprocess import re import requests # Store Mac address of all nodes here saved = { 'xx:xx:xx:xx:xx:xx': 'My laptop', } # Set wireless interface using ifconfig interface = "wlp4s0" mac_regex = re.compile(r'... Add solution -
Python 2022-01-26 13:00:44
How to use open weather weather api for pytho
# importing requests and json import requests, json # base URL BASE_URL = "https://api.openweathermap.org/data/2.5/weather?" # City Name CITY = "Hyderabad" # API key API_KEY = "Your API Key" # upadting the URL URL = BASE_URL ... Add solution -
Python 2022-01-23 06:40:51
check if string is url python
#USE requests.get() TO CHECK IF A STRING IS A URL try: response = requests.get("http://www.avalidurl.com/") print("URL is valid and exists on the internet") except requests.ConnectionError as exception: print("URL doe... Add solution -
Other 2022-01-22 19:36:19
web scraping print all p and h2 tags
import requests from bs4 import BeautifulSoup url = 'https://www.python.org/' reqs = requests.get(url) soup = BeautifulSoup(reqs.text, 'lxml') print("List of all the h1, h2, h3 :") for heading in soup.find_all(["h1", "h2", &q... Add solution -
Other 2021-11-04 12:01:14
Considering the Census Income data with response variable as Income(>50k and <=50k).
def load_dataset(path, urls): if not os.path.exists(path): os.mkdir(path) for url in urls: data = requests.get(url).content filename = os.path.join(path, os.path.basename(url)) with open(filename, "wb") as file:... Add solution -
Other 2021-10-25 02:26:08
web scraping
#pip install beautifulsoup4 #python : import os import requests from bs4 import BeautifulSoup url = "https://www.google.com/" reponse = requests.get(url) if reponse.ok: soup = BeautifulSoup(reponse.text, "lxml") title = str(soup.f... Add solution