• Aug 1, 2025 •AustinLeath
0 likes • 1 view
from typing import Optional from datetime import datetime def convert_timestamp_string_to_epoch(timestamp: str) -> Optional[int]: epoch_time = None time_obj = datetime.strptime(timestamp, "%Y-%m-%d %H:%M:%S.%f") epoch_time = int((time_obj - datetime(1970, 1, 1)).total_seconds() * 1000) return epoch_time print(int(convert_timestamp_string_to_epoch("2025-08-01 13:11:47.171"))) #above outputs 1754053907171.0 #how to I remove the .0 ?
• Nov 19, 2022 •CodeCatch
def key_of_min(d): return min(d, key = d.get) key_of_min({'a':4, 'b':0, 'c':13}) # b
# Python code to find the URL from an input string # Using the regular expression import re def Find(string): # findall() has been used # with valid conditions for urls in string regex = r"(?i)\b((?:https?://|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'\".,<>?«»“”‘’]))" url = re.findall(regex,string) return [x[0] for x in url] # Driver Code string = 'My Profile: https://codecatch.net' print("Urls: ", Find(string))
import math def factorial(n): print(math.factorial(n)) return (math.factorial(n)) factorial(5) factorial(10) factorial(15)
0 likes • 2 views
def byte_size(s): return len(s.encode('utf-8')) byte_size('😀') # 4 byte_size('Hello World') # 11
• Sep 9, 2023 •AustinLeath
0 likes • 24 views
print("test")