This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import smtplib | |
| from email.mime.text import MIMEText | |
| from passwords import EMAIL, EMAIL_APP_PASSWORD | |
| def send_email(message): | |
| sender = EMAIL | |
| recipient = EMAIL | |
| password = EMAIL_APP_PASSWORD |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os | |
| def main(): | |
| i = 0 | |
| source_dir = input('folder path: ') | |
| with os.scandir(source_dir) as entries: | |
| for entry in entries: | |
| i += 1 | |
| print(f'{i} :: {entry.name}') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| options: | |
| r=read, | |
| w=write (change old data to new data), | |
| rb/wb=read/write-binaryy (for binary files), | |
| a=append(add new data to old data). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| soup = BeautifulSoup(src, 'lxml') | |
| soup.select('.mzr-tc-group-table tr th') | |
| # == | |
| soup.find(class_='mzr-tc-group-table').find('tr').find_all('th') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| a, b = 1092, 1092; c = 1092 | |
| print(a is b is c) # True | |
| a, b = 1092, 1092 | |
| c = 1092 | |
| print(a is b, a is c) # True, False | |
| # but | |
| a, b = 92, 92 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from difflib import SequenceMatcher | |
| def Plagiarism_checker(f1, f2): | |
| with open(f1, errors='ignore') as file1, open(f2, errors='ignore') as file2: | |
| f1_data = file1.read() | |
| f2_data = file2.read() | |
| checking = SequenceMatcher(None, f1_data, f2_data).ratio() | |
| print(f'These files are {checking * 100} % similar') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import csv | |
| import re | |
| from collections import Counter | |
| # for find ip's that DDoS server in local log.txt file | |
| def reader(filename): | |
| regexp = r'\d{1, 3}\.\d{1,3}\.d{1,3}' # \d = 0-9 ;; \d{1, 3} = 1-3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Converting a list of strings to a list of integers | |
| numbers = ['1', '2', '3', '4', '5'] | |
| result = list(map(int, numbers)) | |
| print(result) # [1, 2, 3, 4, 5] | |
| # Multiplying each element of a list by 2 | |
| numbers = [1, 2, 3, 4, 5] | |
| result = list(map(lambda x: x*2, numbers)) | |
| print(result) # [2, 4, 6, 8, 10] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import requests | |
| from fake_useragent import UserAgent | |
| response = requests.get('https://httpbin.org/get', headers={'user-agent': UserAgent().random}) | |
| print(response.status_code) | |
| print(f'response.content={response.content}\n') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import requests | |
| with open('proxies.txt') as f: | |
| proxies = f.read().split('\n') | |
| """ or! | |
| proxies = f.readlines() | |
| proxies = [proxy.strip() for proxy in proxies] | |
| """ | |
| working_proxies = [] |
OlderNewer