Справочник Программиста
6.29K subscribers
1.36K photos
387 videos
64 files
1.71K links
По рекламе - @it_start_programmer
Мои курсы - @courses_from_it_start_bot
Сайт - https://it-start.online/
YouTube - https://www.youtube.com/@it_start
Реклама на бирже - https://telega.in/c/programmersGuide_1

Предложить идею: @it_start_suggestion_bot
Download Telegram
#ПроверкаНаОпечатки
Код из видео:

from spellchecker import SpellChecker

spell = SpellChecker(language='ru')

with open('text.txt', 'r', encoding='utf-8') as f:
misspelled = f.read()
misspelled = misspelled.split(' ')
print(misspelled)

misspelled = spell.unknown(misspelled)
print(misspelled)

for word in misspelled:
print(spell.correction(word))
#СозданиеГифки
Код из видео:

from moviepy.editor import *

clip = (VideoFileClip('video.mp4').subclip(3, 7).resize(0.5))

clip.write_gif('gifka.gif')
#МатрицаНаPython
Код из видео:

from tkinter import *
import random
import time

root = Tk()
root.title('Матрица')
root.geometry('700x700+300+300')
root.resizable(width=False, height=False)

c = Canvas(root, width=700, height=700, bg='black')
c.pack()

alphabet = 'qwertyuiop[]{}asdfghjkl;zxcvbnm<>?/|'
alphabet.split()
print(alphabet)
print(len(alphabet))
h = 0

while True:
c.delete('t' + str(h))
for i in range(1, 35):
r = random.randint(0, 35)
ct = c.create_text(20 * i, h, text=str(alphabet[r]), fill='lime', font=('Comic Sans MS', 11), tag='t' + str(h))
rdm = random.randint(1, 10)
for j in range(10):
c.move(ct, 0, rdm)
c.update()
h += 20
if h >= 650:
h = 0

time.sleep(0.1)
👍1
#КонвертацияPDFвTXT
Код из видео:

import pdfminer.high_level

with open('pdfTest.pdf', 'rb') as file:
file1 = open(r"pdfTest.txt", "a+")
pdfminer.high_level.extract_text_to_fp(file, file1)
file1.close()
#СозданиеУведомленийЧерезТелеграмБота
Код из видео:

Уведомления.py
from notifiers import get_notifier
import time
from TOKEN import token, chatId

while True:
what = input('О чём напомнить?\nДля выхода отправьте \'exit\'\n')
if what == 'exit':
break
else:
t = input('Через сколько минут напомнить?\n')
t = int(t) * 60
time.sleep(t)
telegram = get_notifier('telegram')
telegram.notify(token=token, chat_id=chatId, message=what)

TOKEN.py
token = 'Токен вашего бота'
chatId = (Id вашего чата)
Уже 20 минут длится обработка видео.
Всё, видос на канале ;)
#БазаДанныхВPython
Код из видео:

import sqlite3

conn = sqlite3.connect('example.db')

cur = conn.cursor()

cur.execute('''CREATE TABLE IF NOT EXISTS товары (дата text, товар text, количество real, цена real)''')

cur.execute("INSERT INTO товары VALUES ('2021-11-12', 'Журнал', 100, 200)")

products = [('2021-11-13', 'Ручка', 100, 30),
('2021-11-14', 'Тетрадь', 100, 50),
('2021-11-15', 'Мел', 100, 15),
]

cur.executemany("INSERT INTO товары VALUES (?, ?, ?, ?)", products)

cur.execute("SELECT * FROM товары")

for i in cur.fetchall():
print(i)

conn.commit()

conn.close()
#СкачиваниеФайловЧерезPython
Код из видео:

# 1 Способ
import urllib.request
url = 'ссылка'
urllib.request.urlretrieve(url, 'image.png')


# 2 Способ
import requests
url = 'ссылка'
r = requests.get(url)
with open('image.png', 'wb') as f:


# 3 Способ
import wget
url = 'ссылка'
wget.download(url, 'image.png')
#КошелёкНаPython
Код из видео:

def record(total):
with open('text.txt', 'w') as txt:
txt.write(str(total))
print('Баланс обновлён: ', total)

def readd(operation):
with open('text.txt', 'r') as txt:
txt = txt.read()
balance = float(txt)

if operation == 'д':
howMany = float(input('Сколько: '))
record(float(txt) + howMany)
elif operation == 'о':
howMany = float(input('Сколько: '))
record(float(txt) - howMany)
elif operation == 1:
print('На балансе ' + str(balance) + 'руб \n')


while True:
readd(1)
readd(input('Добавить/Отнять\n Д/О: ').lower())