Character to unicode
myname='John Doe' a = '' for index in range(len(myname)): a += 'U'+(format(ord(myname[index]), '04x')) + ' ' #a = U004a U006f…
myname='John Doe' a = '' for index in range(len(myname)): a += 'U'+(format(ord(myname[index]), '04x')) + ' ' #a = U004a U006f…
mylist = [1, 2, 3, 4, 5] mylist.append(10) => [1, 2, 3, 4, 5, 10] mylist.pop(4) => [1, 2, 3,…
import pyautogui as pag import random import time while True: x = random.randint(800, 900) y = random.randint(100, 700) pag.moveTo(x, y,…
import time print(dir(time)) # Prints list which contains names of attributes in time function Output: ['CLOCK_BOOTTIME', 'CLOCK_MONOTONIC', 'CLOCK_MONOTONIC_RAW', 'CLOCK_PROCESS_CPUTIME_ID', 'CLOCK_REALTIME',…
print('Goodbye, Russia!') Output: Goodbye, Russia
from flask import Flask, render_template app= Flask(__name__) led1,led2,led3= 3,5,7 rpi.setwarnings(False) rpi.setmode(rpi.BOARD) rpi.setup(led1, rpi.OUT) rpi.setup(led2, rpi.OUT) rpi.setup(led3, rpi.OUT) rpi.output(led1, 0) rpi.output(led2,…
strip() and title() m = " John" n = "wayne " o = "mary " p = "POPPINS" print('{} {}'.format(m.strip().title(),…
Days between two dates from datetime import date now = date.today() previous_date = date(2022, 2, 24) delta = now -…
# Create db, table, insert into table, select from table import sqlite3 sql_con = sqlite3.connect('db/test.db') # If db doesn't exist…
from datetime import datetime now = datetime.now() print(now.strftime("%a")) # Sun print(now.strftime("%A")) # Sunday print(now.strftime("%w")) # 0, 0=sunday, 1=Monday... print(now.strftime("%d")) #…