Python/ django
58.9K subscribers
2.08K photos
61 videos
47 files
2.79K links
по всем вопросам @haarrp

@itchannels_telegram - 🔥 все ит-каналы

@ai_machinelearning_big_data -ML

@ArtificialIntelligencedl -AI

@datascienceiot - 📚

@pythonlbooks

РКН: clck.ru/3FmxmM
加入频道
📩 Python Email Automation: Enhancing Efficiency and Productivity with Streamlined Operations

Автоматизация отправки электронной почты на Python: Повышение эффективности и производительности за счет оптимизации операций.


import pandas as pd
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText

def read_excel(file_name):
data = pd.read_excel(file_name, engine='openpyxl')
return data

def send_email(receiver_address, sender_address, sender_pass, subject, body):
msg = MIMEMultipart()
msg['From'] = sender_address
msg['To'] = receiver_address
msg['Subject'] = subject

msg.attach(MIMEText(body, 'plain'))

# Use the appropriate SMTP server
# For Gmail
server = smtplib.SMTP('smtp.gmail.com', 587)
# For Office 365
# server = smtplib.SMTP('smtp.office365.com', 587)
# For iCloud
# server = smtplib.SMTP('smtp.mail.me.com', 587)

server.starttls()
server.login(sender_address, sender_pass)

text = msg.as_string()
server.sendmail(sender_address, receiver_address, text)
server.quit()

def automate_emails(data_frame, sender_address, sender_pass, subject):
for index, row in data_frame.iterrows():
send_email(row['email'], sender_address, sender_pass, subject, f"Hello {row['name']},\n{row['message']}")

data_frame = read_excel('emailsend.xlsx')

# Replace '[email protected]' and 'your-password' with your own credentials. Pass the app password as the third parameter.

automate_emails(data_frame, '', '', '')


@pythonl
🤓 StackOverflow Question Scraper

Парсер вопросов StackOverflow на Python.

from bs4 import BeautifulSoup
import requests
import json

fmt = "https://stackoverflow.com/questions/tagged/{tag}?tab={filter}&pagesize=15"
filters = [
"1. Newest",
"2. Active",
"3. Bounties",
"4. Unanswered",
"5. Frequent",
"6. Votes",
]

tag = input("enter any question tag (python, java)\n")
print("\n".join(filters))
filter = int(input("enter the filter number (1, 3, 5)\n"))

try:
filter = filters[filter].split(" ")[-1]
except:
filter = "Votes"

# generate dynamic URL with user preferences
URL = fmt.format(tag=tag, filter=filter)

print("generated URL ", URL)
content = requests.get(URL).content

soup = BeautifulSoup(content, "lxml")

# return only question tags
def is_question(tag):
try:
return tag.get("id").startswith("question-summary-")
except:
return False


questions = soup.find_all(is_question)
question_data = []
if questions:
# extract question data like votes, title, link and date
for question in questions:
question_dict = {}
question_dict["votes"] = (
question.find(class_="s-post-summary--stats-item-number").get_text().strip()
)
h3 = question.find(class_="s-post-summary--content-title")
question_dict["title"] = h3.get_text().strip()
question_dict["link"] = "https://stackoverflow.com" + h3.find("a").get("href")
question_dict["date"] = (
question.find(class_="s-user-card--time").span.get_text().strip()
)
question_data.append(question_dict)

with open(f"questions-{tag}.json", "w") as f:
json.dump(question_data, f)

print("file exported")

else:
print(URL)
print("looks like there are no questions matching your tag ", tag)


@pythonl
Please open Telegram to view this post
VIEW IN TELEGRAM
⚡️Маст-хэв список программистов, каналы с последними книжными новинками, библиотеками, разбором кода и актуальной информацией, связанной с вашим языком программирования.
Лучший способ получать свежие обновлении и следить за трендами в разработке.

Python: t.me/pro_python_code
C#: t.me/csharp_ci
C/C++/ t.me/cpluspluc
Машинное обучение: t.me/ai_machinelearning_big_data
Data Science: t.me/data_analysis_ml
Devops: t.me/devOPSitsec
Go: t.me/Golang_google
Базы данных: t.me/sqlhub
Rust: t.me/rust_code
Javascript: t.me/javascriptv
React: t.me/react_tg
PHP: t.me/phpshka
Android: t.me/android_its
Мобильная разработка: t.me/mobdevelop
Linux: t.me/+A8jY79rcyKJlYWY6
Big Data: t.me/bigdatai
Хакинг: t.me/linuxkalii
Java: t.me/javatg

💼 Папка с вакансиями: t.me/addlist/_zyy_jQ_QUsyM2Vi
Папка Go разработчика: t.me/addlist/MUtJEeJSxeY2YTFi
Папка Python разработчика: t.me/addlist/eEPya-HF6mkxMGIy

🎞 YouTube канал: https://www.youtube.com/@uproger

😆ИТ-Мемы: t.me/memes_prog

🇬🇧Английский: t.me/english_forprogrammers
Please open Telegram to view this post
VIEW IN TELEGRAM
📶 Get Saved Wi-Fi Passwords

Скрипт для извлечения всех сохраненных wi-fi паролей в текстовый файл.

import subprocess
import re

# Get all the Wi-Fi profiles (ssid)
out = subprocess.check_output("netsh wlan show profiles").decode()

# Filter out only profile names from the output
matches = re.findall(r"(All User Profile)(.*)", out)

# List comprehension to remove any \n \r \t and spaces
profiles = [str(match[1]).split(":")[1].strip() for match in matches]


# File object to store passwords with ssid
with open("passwords.txt", "w+") as f:

# Traversing each profile
for profile in profiles:
# try/except block to keep the script from crashing if there was an error while execution
try:
# Get password using key=clear flag
get_pass = subprocess.check_output(
f'netsh wlan show profile "{profile}" key=clear'
).decode()

# Filter out the Password line from the output
pass_by_profile = re.search(r"(Key Content)(.*)", get_pass)

# Check if the password is present or wi-fi was open
if pass_by_profile:
password = pass_by_profile.group().split(":")[1].strip()
else:
password = "THE WIFI IS OPEN"

# Write the profile name and password to the text file
f.write(f"{profile} : {password}\n")
except Exception:
continue

@pythonl
Please open Telegram to view this post
VIEW IN TELEGRAM
🔑 Making a password generator with Python GUI

Создание генератора паролей с графическим интерфейсом на Python.

import random
import string
import tkinter as tk
import pyperclip
root = tk.Tk()
root.geometry('500x500')
root.title('PASSWORD GENERATOR')

letters = string.ascii_letters
digits = string.digits
special_chars = string.punctuation

alphabet = letters + digits + special_chars

pwd_length = ''
pwd = ''

def create_pass():
global alphabet
global pwd_length
global pwd
pwd_length = int(pass_length.get())
pwd = ''
for i in range(pwd_length):
pwd += ''.join(random.choice(alphabet))
text_result.config(text=pwd)

def copy_pwd():
if pwd == '':
lbl_alert.config(text='Create a password first')
else:
pyperclip.copy(pwd)
lbl_alert.config(text='Succesfuly copied')

text_result = tk.Label(root, text='')
text_result.pack()

pass_length = tk.Entry(root)
pass_length.pack()

btn = tk.Button(root, text='Start', command=create_pass)
btn.pack()

btn_copy = tk.Button(root, text='Copy to clipboard', command=copy_pwd)
btn_copy.pack()

lbl_alert = tk.Label(root, text='')
lbl_alert.pack()

root.mainloop()


@pythonl
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
🖥 8 delightful Python scripts that will brighten your day

8 крутых скриптов Python, которые скрасят ваш день.

Эти маленькие драгоценные камни добавят немного веселья в ваши проекты по программированию.

1. Тест скорости *изображение 1.
2. Конвертация фотографии в мультяшный формат *изображение 2.
3. Вывод статуса сайта *изображение 3.
4. Улучшение изображений *изображение 4.
5. Создание веб-бота *изображение 5.
6. Преобразование: Hex в RGB *изображение 6.
7. Преобразование PDF в изображения *изображение 7.
8. Получить текст песни *изображение 8.

@pythonl
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
🖥 Excel File Automation

Создание и работа с excel-файлами с помощью python-скрипта.

from openpyxl import Workbook
from openpyxl.utils import get_column_letter
from openpyxl.styles import Font

#making the grid and giving the data
data = {
"Joe": {
"math": 65,
"science": 78,
"english": 98,
"gym": 89
},
"Bill": {
"math": 55,
"science": 72,
"english": 87,
"gym": 95
},
"Tim": {
"math": 100,
"science": 45,
"english": 75,
"gym": 92
},
"Sally": {
"math": 30,
"science": 25,
"english": 45,
"gym": 100
},
"Jane": {
"math": 100,
"science": 100,
"english": 100,
"gym": 60
}
}

wb = Workbook()
ws = wb.active
#assigning the title
ws.title = "Grades"
#giving proper formatting for columns
headings = ['Name'] + list(data['Joe'].keys())
ws.append(headings)

#reading the data for persom
for person in data:
grades = list(data[person].values())
ws.append([person] + grades)

for col in range(2, len(data['Joe']) + 2):
char = get_column_letter(col)
ws[char + "7"] = f"=SUM({char + '2'}:{char + '6'})/{len(data)}"
#assigning the colour and text type
for col in range(1, 6):
ws[get_column_letter(col) + '1'].font = Font(bold=True, color="0099CCFF")

#saving the excel file in the same folder
wb.save("NewGrades.xlsx")


@pythonl
Please open Telegram to view this post
VIEW IN TELEGRAM
This media is not supported in your browser
VIEW IN TELEGRAM
🔥🔥 VideoCrafter:A Toolkit for Text-to-Video Generation and Editing

A Toolkit for Text-to-Video Generation and Editing

Опенсоурс алгоритм для генерации видеоконтента и преобразования текста в видео.


Github
Colab

@pythonl
⚡️Маст-хэв список для программистов, каналы с последними книжными новинками, библиотеками, разбором кода и актуальной информацией, связанной с вашим языком программирования.
Лучший способ получать свежие обновлении и следить за трендами в разработке.

Машинное обучение: t.me/ai_machinelearning_big_data
Python: t.me/pro_python_code
C#: t.me/csharp_ci
C/C++/ t.me/cpluspluc
Data Science: t.me/data_analysis_ml
Devops: t.me/devOPSitsec
Go: t.me/Golang_google
Базы данных: t.me/sqlhub
Rust: t.me/rust_code
Javascript: t.me/javascriptv
React: t.me/react_tg
PHP: t.me/phpshka
Android: t.me/android_its
Мобильная разработка: t.me/mobdevelop
Linux: t.me/+A8jY79rcyKJlYWY6
Big Data: t.me/bigdatai
Хакинг: t.me/linuxkalii
Тестирование: https://yangx.top/+F9jPLmMFqq1kNTMy
Java: t.me/javatg

💼 Папка с вакансиями: t.me/addlist/_zyy_jQ_QUsyM2Vi
Папка Go разработчика: t.me/addlist/MUtJEeJSxeY2YTFi
Папка Python разработчика: t.me/addlist/eEPya-HF6mkxMGIy

📕 Бесплатные Книги для программистов: https://yangx.top/addlist/YZ0EI8Ya4OJjYzEy

🎞 YouTube канал: https://www.youtube.com/@uproger

😆ИТ-Мемы: t.me/memes_prog

🇬🇧Английский: t.me/english_forprogrammers
Please open Telegram to view this post
VIEW IN TELEGRAM
🐍Ten New Features of Python 3.11 That Make Your Code More Efficient

10 новых возможностей Python 3.11, которые сделают ваш код более эффективным.

01 Pattern Matching
*изображение 1.

02 Structural Pattern Matching
*изображение 2.

03 Type Hints and Checks
*изображение 3.

04 Оптимизация производительности
*изображение 4.

05 Улучшения отчетов об ошибках
*изображение 5.

06 Новая стандартная библиотека zoneinfo
*изображение 6.

07 iterate
*изображение 7.

08 Merge Dictionary Operator
*изображение 8.

09 Новая функция точки прерывания отладки
*изображение 9.

10 Синхронная итерация
*изображение 10.

@pythonl