Python 3 Find IP Address of Domain Name Using Socket Module

Python 3 Find IP Address of Domain Name Using Socket Module

July 7, 2022

code.py import socket hostname = input("Please enter website address:\n") # IP lookup from hostname print(f'The {hostname} IP Address is {socket.gethostbyname(hostname)}')

Python 3 Find Domain Name From IP Address Using Socket Module

July 6, 2022

code.py import socket print(socket.gethostbyaddr("188.166.49.53"))

Python 3 Selenium Open URLs in Multiple Tabs inside Browser

July 6, 2022

main.py # Necessary imports from selenium import webdriver # initially webdriver is empty webdriver.driver = None browserName = input("Enter your…

Python 3 Find Difference Between Two Timestamps in Minutes

July 6, 2022

code.py from datetime import datetime fmt = '%Y-%m-%d %H:%M:%S' tstamp1 = datetime.strptime('2016-04-06 21:26:27', fmt) tstamp2 = datetime.strptime('2016-04-07 09:06:02', fmt) if…

Python 3 Find Difference Between Two Timestamps in Days

July 6, 2022

code.py import datetime min = min/1000 #removing milli seconds max = max/1000 min = datetime.datetime.fromtimestamp(min) max = datetime.datetime.fromtimestamp(max) print("Total Days…

Python 3 Find Difference Between Two Lists Using set() Method

July 6, 2022

code1.py # Python code t get difference of two lists # Using set() def Diff(li1, li2): return list(set(li1) - set(li2))…

Python 3 Find Difference Between Two Dates in Hours, Minutes & Seconds

July 6, 2022

code.py import datetime data1 = datetime.datetime.now() data2 = datetime.datetime.now() diff = data2 - data1 days, seconds = diff.days, diff.seconds hours…

Python 3 Find Difference Between Two Dates in Years, Months, Days, Hours, Minutes & Seconds

July 6, 2022

code.py import datetime from dateutil.relativedelta import relativedelta a = '2014-05-06 12:00:56' b = '2013-03-06 16:08:22' start = datetime.datetime.strptime(a, '%Y-%m-%d %H:%M:%S')…

Python 3 Find Difference Between Two Timestamps in Milliseconds

July 6, 2022

code.py from datetime import datetime date_1 = '24/7/2021 11:13:08.230010' date_2 = '24/7/2021 11:14:18.333338' date_format_str = '%d/%m/%Y %H:%M:%S.%f' start = datetime.strptime(date_1,…

Python 3 Pandas Code to Find the Difference Between Two Datetimes in Milliseconds

July 6, 2022

main.py import pandas as pd from datetime import datetime date_1 = '2/7/2021 21:55:12.230010' date_2 = '24/9/2023 11:13:08.333338' date_format_str = '%d/%m/%Y…