Aprende Python
الذهاب إلى القناة على Telegram
Recursos de aprendizaje para Python, Dango y Flask. Contacto @JoseAJimenez #Python #recursos
إظهار المزيد5 542
المشتركون
+424 ساعات
+217 أيام
+10630 أيام
أرشيف المشاركات
5 542
Repost from Python/ django
🕸 Python Web Scraping
Этот исчерпывающий список содержит библиотеки python, связанные с веб-парсингом и обработкой данных.
Web Scraping: Frameworks
scrapy - web-scraping framework (twisted based).
•pyspider - A powerful spider system.
•autoscraper - A smart, automatic and lightweight web scraper
•grab - web-scraping framework (pycurl/multicurl based)
•ruia - Async Python 3.6+ web scraping micro-framework based on asyncio
•cola - A distributed crawling framework.
•frontera - A scalable frontier for web crawlers
•dude - A simple framework for writing web scrapers using decorators.
•ioweb - Web scraping framework based on gevent and lxml
Web Scraping : Tools
•portia - Visual scraping for Scrapy.
•restkit - HTTP resource kit for Python. It allows you to easily access to HTTP resource and build objects around it.
•requests-html - Pythonic HTML Parsing for Humans.
•ScrapydWeb - A full-featured web UI for Scrapyd cluster management, which supports Scrapy Log Analysis & Visualization, Auto Packaging, Timer Tasks, Email Notice and so on.
•Starbelly - Starbelly is a user-friendly and highly configurable web crawler front end.
•Gerapy - Distributed Crawler Management Framework Based on Scrapy, Scrapyd, Django and Vue.js
Web Scraping : Bypass Protection
•cloudscraper - A Python module to bypass Cloudflare's anti-bot page.
▪ GIthub
@pythonl
5 542
Artículo que introduce a los conceptos de Manager y QuerySet en Django con un ejemplo donde muestra sus diferencias, virtudes y defectos.
https://bit.ly/3D47Dyg
#django #bd
Apoyame, lo agradecería mucho y es un factor motivante muy importante.
Ko-fi https://ko-fi.com/josjimenez
Buy me Coffe https://buymeacoffee.com/jajt
PayPal https://paypal.me/JoseAJimenez
Amazon afiliados https://amzn.to/3s0zEk2
5 542
El siguiente artículo no es de desarrollo propiamente dicho, pero me ha parecido muy interesante, y desconocido para mi, lo que explica.
Dentro de la librería estandar de Python tenemos un conjunto de módulo que se pueden utilizar como herramienta para terminal con python -m nombre_modulo.
En el siguiente artículo muestra como ha descubierto todas esas herramientas y explica alguna de ellas.
https://bit.ly/3pvLKoH
#CLI
Apoyame, lo agradecería mucho y es un factor motivante muy importante.
Ko-fi https://ko-fi.com/josjimenez
Buy me Coffe https://buymeacoffee.com/jajt
PayPal https://paypal.me/JoseAJimenez
Amazon afiliados https://amzn.to/3s0zEk2
5 542
El siguiente enlace es un repositorio de GitHub con una colección de scripts para automatizar tareas comunes, te puedes encontrar desde tareas para backup, desarrollo web(testing, despliegue o scraping), Data Science, seguridad y otras.
https://github.com/Chamepp/Daily.py
#automatizacion
Apoyame, lo agradecería mucho y es un factor motivante muy importante.
Ko-fi https://ko-fi.com/josjimenez
Buy me Coffe https://buymeacoffee.com/jajt
PayPal https://paypal.me/JoseAJimenez
Amazon afiliados https://amzn.to/3s0zEk2
5 542
Repost from Python/ django
🖥 10 Advanced Python Scripts For Everyday Programming
10 полезных скриптов Python для повседневных задач
1. SpeedTest with Python
# pip install pyspeedtest
# pip install speedtest
# pip install speedtest-cli
#method 1
import speedtest
speedTest = speedtest.Speedtest()
print(speedTest.get_best_server())
#Check download speed
print(speedTest.download())
#Check upload speed
print(speedTest.upload())
# Method 2
import pyspeedtest
st = pyspeedtest.SpeedTest()
st.ping()
st.download()
st.upload()
2. Search on Google
# pip install google
from googlesearch import search
query = "Medium.com"
for url in search(query):
print(url)
3. Make Web Bot
# pip install selenium
import time
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
bot = webdriver.Chrome("chromedriver.exe")
bot.get('[http://www.google.com'](http://www.google.com'))
search = bot.find_element_by_name('q')
search.send_keys("@codedev101")
search.send_keys(Keys.RETURN)
time.sleep(5)
bot.quit()
4. Fetch Song Lyrics
# pip install lyricsgenius
import lyricsgenius
api_key = "xxxxxxxxxxxxxxxxxxxxx"
genius = lyricsgenius.Genius(api_key)
artist = genius.search_artist("Pop Smoke", max_songs=5,sort="title")
song = artist.song("100k On a Coupe")
print(song.lyrics)
5. Get Exif Data of Photos
# Get Exif of Photo
# Method 1
# pip install pillow
import PIL.Image
import PIL.ExifTags
img = PIL.Image.open("Img.jpg")
exif_data =
{
PIL.ExifTags.TAGS[i]: j
for i, j in img._getexif().items()
if i in PIL.ExifTags.TAGS
}
print(exif_data)
# Method 2
# pip install ExifRead
import exifread
filename = open(path_name, 'rb')
tags = exifread.process_file(filename)
print(tags)
6. OCR Text from Image
# pip install pytesseract
import pytesseract
from PIL import Image
pytesseract.pytesseract.tesseract_cmd = r'C:\Program Files\Tesseract-OCR\tesseract.exe'
t=Image.open("img.png")
text = pytesseract.image_to_string(t, config='')
print(text)
7. Convert Photo into Cartonize
# pip install opencv-python
import cv2
img = cv2.imread('img.jpg')
grayimg = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
grayimg = cv2.medianBlur(grayimg, 5)
edges = cv2.Laplacian(grayimg , cv2.CV_8U, ksize=5)
r,mask =cv2.threshold(edges,100,255,cv2.THRESH_BINARY_INV)
img2 = cv2.bitwise_and(img, img, mask=mask)
img2 = cv2.medianBlur(img2, 5)
cv2.imwrite("cartooned.jpg", mask)
8. Empty Recycle Bin
# pip install winshell
import winshell
try:
winshell.recycle_bin().empty(confirm=False, /show_progress=False, sound=True)
print("Recycle bin is emptied Now")
except:
print("Recycle bin already empty")
9. Python Image Enhancement
# pip install pillow
from PIL import Image,ImageFilter
from PIL import ImageEnhance
im = Image.open('img.jpg')
# Choose your filter
# add Hastag at start if you don't want to any filter below
en = ImageEnhance.Color(im)
en = ImageEnhance.Contrast(im)
en = ImageEnhance.Brightness(im)
en = ImageEnhance.Sharpness(im)
# result
en.enhance(1.5).show("enhanced")
10. Get Window Version
# Window Version
import wmi
data = wmi.WMI()
for os_name in data.Win32_OperatingSystem():
print(os_name.Caption) # Microsoft Windows 11 Home
@pythonl5 542
Repost from DLeX: AI Python
📽 Python for DataScience | Short Courses
آموزش ویدیویی مقدمات پایتون برای علوم داده.
🔗 https://youtu.be/yGN28LY5VuA
#Python #DataScience
#Courses
@ai_python
5 542
5 542
Si quieres hacer una pequeña aportación para mejorar mis proyectos lo puedes hacer por los métodos que he descrito en el mensaje anterior, o por Telegram, os lo agradecería mucho.
5 542
El siguiente enlace tenemos un artículo donde explica como escribir código de calidad y como automatizar ese proceso.
https://bit.ly/3r7P4qj
#desarrollo #calidad
Apoyame, lo agradecería mucho y es un factor motivante muy importante.
Ko-fi https://ko-fi.com/josjimenez
Buy me Coffe https://buymeacoffee.com/jajt
PayPal https://paypal.me/JoseAJimenez
Amazon afiliados https://amzn.to/3s0zEk2
Audio Curso Aprendiendo Telegram https://mumbler.io/aprendiendo-telegram
5 542
En el siguiente artículo es una reflexión sobre algo que los programadores se enfrentan a diario que es la depuración de ćodigo. El autor explica porque y como depurar código de forma eficiente.
https://bit.ly/46vDGF6
#debug
Apoyame, lo agradecería mucho y es un factor motivante muy importante.
Ko-fi https://ko-fi.com/josjimenez
Buy me Coffe https://buymeacoffee.com/jajt
PayPal https://paypal.me/JoseAJimenez
Amazon afiliados https://amzn.to/3s0zEk2
Audio Curso Aprendiendo Telegram https://mumbler.io/aprendiendo-telegram
5 542
Como configurar un sistema de cache utilizando Redis en Django, en el siguiente artículo te explica como hacerlo y con un ejemplo práctico.
https://bit.ly/3CTfUoN
#django #cache
Apoyame, lo agradecería mucho y es un factor motivante muy importante.
Ko-fi https://ko-fi.com/josjimenez
Buy me Coffe https://buymeacoffee.com/jajt
PayPal https://paypal.me/JoseAJimenez
Amazon afiliados https://amzn.to/3s0zEk2
Audio Curso Aprendiendo Telegram https://mumbler.io/aprendiendo-telegram
5 542
Lo anterior esta en ruso, recordar que Telegram permite traducir texto y del Ruso a Español esta soportado.
5 542
Repost from Python/ django
🔥 10 Tips And Tricks To Write Better Python Code
10 советов и приемов для написания лучшего кода на Python
1) Iterate c enumerate() вместо range(len())
data = [1, 2, -3, -4]
# плохо:
for i in range(len(data)):
if data[i] < 0:
data[i] = 0
# хорошо:
data = [1, 2, -3, -4]
for idx, num in enumerate(data):
if num < 0:
data[idx] = 0
2) list comprehension вместо for-loops
#плохо:
squares = []
for i in range(10):
squares.append(i*i)
# хорошо:
squares = [i*i for i in range(10)]
3) sorted() method
data = (3, 5, 1, 10, 9)
sorted_data = sorted(data, reverse=True) # [10, 9, 5, 3, 1]
data = [{"name": "Max", "age": 6},
{"name": "Lisa", "age": 20},
{"name": "Ben", "age": 9}
]
sorted_data = sorted(data, key=lambda x: x["age"])
4) Хранение данных в Sets
my_list = [1,2,3,4,5,6,7,7,7]
my_set = set(my_list) # removes duplicates
primes = {2,3,5,7,11,13,17,19}
5) Экономьте память с помощью генераторов
# list comprehension
my_list = [i for i in range(10000)]
print(sum(my_list)) # 49995000
# generator comprehension
my_gen = (i for i in range(10000))
print(sum(my_gen)) # 49995000
import sys
my_list = [i for i in range(10000)]
print(sys.getsizeof(my_list), 'bytes') # 87616 bytes
my_gen = (i for i in range(10000))
print(sys.getsizeof(my_gen), 'bytes') # 128 bytes
6) Определение значений по умолчанию в словарях с помощью .get() и .setdefault()
my_dict = {'item': 'football', 'price': 10.00}
count = my_dict['count'] # KeyError!
# лучше:
count = my_dict.get('count', 0) # optional default value
count = my_dict.setdefault('count', 0)
print(count) # 0
print(my_dict) # {'item': 'football', 'price': 10.00, 'count': 0}
7) Подсчет хэшируемых объектов с помощью collections.Counter
from collections import Counter
my_list = [10, 10, 10, 5, 5, 2, 9, 9, 9, 9, 9, 9]
counter = Counter(my_list)
print(counter) # Counter({9: 6, 10: 3, 5: 2, 2: 1})
print(counter[10]) # 3
from collections import Counter
my_list = [10, 10, 10, 5, 5, 2, 9, 9, 9, 9, 9, 9]
counter = Counter(my_list)
most_common = counter.most_common(2)
print(most_common) # [(9, 6), (10, 3)]
print(most_common[0]) # (9, 6)
print(most_common[0][0]) # 9
8 ) Форматирование строк с помощью f-Strings
name = "Alex"
my_string = f"Hello {name}"
print(my_string) # Hello Alex
i = 10
print(f"{i} squared is {i*i}") # 10 squared is 100
9) Конкатенация строк с помощью .join()
list_of_strings = ["Hello", "my", "friend"]
#плохо:
my_string = ""
for i in list_of_strings:
my_string += i + " "
#хорошо
list_of_strings = ["Hello", "my", "friend"]
my_string = " ".join(list_of_strings)
10) Слияние словарей с синтаксисом двойной звездочки **.
d1 = {'name': 'Alex', 'age': 25}
d2 = {'name': 'Alex', 'city': 'New York'}
merged_dict = {**d1, **d2}
@pythonl5 542
5 542
También me puedes apoyar por Telegram, estaré muy agradecido y motivara para seguir en estos días tan caluroso.
5 542
Como diseñar una API "pythonic", en el siguiente artículo explica las cualidades que debe tener una buena API.
https://bit.ly/3pnYWvJ
#API
Apoyame, lo agradecería mucho y es un factor motivante muy importante.
Buy me Coffe https://buymeacoffee.com/jajt
PayPal https://paypal.me/JoseAJimenez
Amazon afiliados https://amzn.to/3s0zEk2
Audio Curso Aprendiendo Telegram https://mumbler.io/aprendiendo-telegram
5 542
¿Sabes lo que es LoB "the location of Behaviour"? En caso negativo ,puedes aprenderlo en el siguiente artículo donde lo aplica a las URLs y vistas de Django.
https://bit.ly/3pkxTS3
#django
5 542
El siguiente artículo es como dice "café para muy cafeteros" porque trata de como hacer con Python un hypervisor de KVM.
https://www.devever.net/~hl/kvm
#virtualizacion
Apoyame, lo agradecería mucho y es un factor motivante muy importante.
Buy me Coffe https://buymeacoffee.com/jajt
PayPal https://paypal.me/JoseAJimenez
Amazon afiliados https://amzn.to/3s0zEk2
Audio Curso Aprendiendo Telegram https://mumbler.io/aprendiendo-telegram
