Aprende Python
前往频道在 Telegram
Recursos de aprendizaje para Python, Dango y Flask. Contacto @JoseAJimenez #Python #recursos
显示更多5 311
订阅者
无数据24 小时
+177 天
+8630 天
帖子存档
5 311
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 311
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 311
Repost from DLeX: AI Python
📽 Python for DataScience | Short Courses
آموزش ویدیویی مقدمات پایتون برای علوم داده.
🔗 https://youtu.be/yGN28LY5VuA
#Python #DataScience
#Courses
@ai_python
5 311
5 311
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 311
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 311
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 311
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 311
Lo anterior esta en ruso, recordar que Telegram permite traducir texto y del Ruso a Español esta soportado.
5 311
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 311
5 311
También me puedes apoyar por Telegram, estaré muy agradecido y motivara para seguir en estos días tan caluroso.
5 311
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 311
¿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 311
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
5 311
En este caso es un recurso algo diferente, porque no es un enlace a una web, si no un un enlace compartido de una carpeta Data Science.
Para quien no sepa que es esa funcionalidad en Telegram, el siguiente enlace es de un carpeta con grupos y canales de ese ámbito. cuando pulsas en el enlace, tendrás un listado que podrás decidir donde entras y donde no, cuando confirmas en tu cliente de Telegram aparecerá esa carpeta con los canales y grupo que te has unido.
Asi que aquí tienes una carpeta de Data Science.
https://t.me/addlist/8_rRW2scgfRhOTc0
5 311
Cuando estas aprendiendo de nuevo ámbito y de los problemas es encontrar buenos ejemplos y datos para practicar. Pues si en un caso estas empezando en el mundo de Data Science, en el enlace siguientes encontraras 32 datasets(conjuntos de datos) de diversos ámbitos y niveles de dificultad, con una pregunta tipo desafio, para que practiques y mejores tus habilidades.
https://bit.ly/430wGwX
#datos
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 311
现已上线!2025 年 Telegram 研究 — 年度关键洞察 
