import json
def read_json(file_path):
with open(file_path, 'r') as file:
return json.load(file)
from urllib.parse import urlparse, parse_qs
def extract_query_params(url):
parsed_url = urlparse(url)
return parse_qs(parsed_url.query)
def reverse_string(s):
return s[::-1]
def count_characters(s):
count = {}
for char in s:
count[char] = count.get(char, 0) + 1
return count
import re
def is_valid_email(email):
pattern = r"^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$"
return re.match(pattern, email) is not None
from urllib.parse import urlparse
def get_domain_name(url):
return urlparse(url).netloc
from urllib.parse import urlparse
def extract_domain(url):
return urlparse(url).netloc
import os
def get_file_extension(file_path):
_, file_extension = os.path.splitext(file_path)
return file_extension
import os
def join_path(directory, filename):
return os.path.join(directory, filename)
import os
def file_exists(file_path):
return os.path.isfile(file_path)