Uz Python dev Logs | Stay at home


Гео и язык канала: не указан, не указан
Категория: не указана


Uz Python Logs (notes)
Bu yerda Python dasturlash tiliga oid sharhlarni o'zbek tilida kuzatib borishingiz mumkin
👋 Bu yerda siz ham o'zingiz qiziqtirgan mavzuda qiziqarli ma'lumotlar e'lon qilishingiz mumkin
Aloqa: @AzamMamatmurodov
Ishlar: @uzpythonjobs

Связанные каналы

Гео и язык канала
не указан, не указан
Категория
не указана
Статистика
Фильтр публикаций


Ajoyib podkast: Python Ota-Onalar uchun 😉

Butun dunyo bo'ylab ayni paytda karantin, shu fursatdan foydalanib farzandlaringizga, aka-ukalaringizga yoki yoshi kichik yaqinlarimizga Python'ni o'rgatish ayni payti.

Nima uchunligini podkastda tinglaymiz 🤓

👉 https://fireside.fm/s/UIYXtbeL+JetKF9gl

👉 @uzpythonlogs
#podcast, #teaching, #audiopodcast, #learning
Teaching Python Episode 41: Pythonic Parenting With The Shaw Family
Python for Parents, so you want your child to code? Sometimes it just takes a few creative ideas and a short amount of time to make some fun little projects. Sean and Kelly, with the help of Anthony Shaw and his lovely daughters, ‘ Zebra’ and ‘Jaguar’ have a little fun with this topic!


Python bo'yicha foydali qo'llanmalar, yo'riqnomalar yozishni va o'z tajribangiz bilan ulashishni istaysizmi ? Unda bizning jamoaga qo'shiling ! 👩‍💻👨‍💻

Keling o'zbek tilidagi kontentlarni ko'paytirish orqali Python community'ni qo'llab-quvvatlaylik.😀 Agar sizda ham shunday istak bo'lsa, marhamat bizga qo'shiling va o'zbek tilida foydali kontentlarni sonini ko'paytiring 👏

👉 @uzpythonlogs
#CommunitySupport, #TeamBuilding, #Bloggers




Virtual yordamchingiz bo'lishi haqida hech o'ylab ko'rganmisiz ? 🤖

Misol uchun siz aytasiz do'stim Dostonga email yubor, u sizning o'rningizga xabarni yozib, jo'natadi.
Siz faqatgina savollarga og'zaki javob berib turasiz.

Ishingiz osonlashadi, to'g'rimi ? 😁
Quyidagi havolada shu bo'yicha qo'llanma berilgan, o'qing va ishlatib ko'ring!

https://morioh.com/p/9ef30e340ac5

👉 @uzpythonlogs
#goodlink, #goodresource, #tutorial, #tutor


Pythonni o'rganish uchun juda ko'p resurslar bor 👨‍💻👩‍💻

Shu resurslardan yaxshilaridan biri bo'lgan Mosh Hamedanining video darsligini tavsiya etaman. Video kursda Python juda ham yaxshi tushuntirilgan, faqat bir tomoni - ingliz tilida :)! O'ylaymanki bu muammo bo'lmaydi. 🤓

👋 https://www.youtube.com/watch?v=_uQrJ0TkZlc

👉 @uzpythonlogs
#goodlink, #goodresource, #tutorial, #tutor


Foydali kutubxonalar:

tqdm - Python va Terminal uchun, tezkor va kengaytiriladigan progress bar
schedule - Python uchun jadval(cron), ishlarni rejalashtirish uchun ishlatiladi
Redis Simple Cache - Python funksiyasi natijalarini, JSON kodlangan satrlari yoki htmlni saqlash uchun oddiy redis asoslangan Kesh

👉 @uzpythonlogs
#goodlink, #goodlibrary, #goodresource, #easysolutions


Pyladies haqida hech eshitganmisiz ?

PyLadies xalqaro mentorlik guruhi bo'lib, ko'proq ayollarga Python ochiq manbali hamjamiyatining faol ishtirokchilari va rahbarlariga aylanishiga yordam beradi.

Website: https://www.pyladies.com/
Twitter: https://twitter.com/pyladies

👉 @uzpythonlogs
#SupportLadies, #Community, #OpenSource


Видео недоступно для предпросмотра
Смотреть в Telegram
Dasturlash tillarini yillar davomida o'sishi

✌️ Python, ayniqsa oxirgi yillarda o'z o'rnini bermay kelayapti

👉 @uzpythonlogs




1. from math import pi
print(pi)

2. import math
print(math.pi)

Savol:
1. 1 va 2 holat qanday farqi bor ?
2. Bir-biridan nima avfzalligi bor ?

Javoblarni komentariyada muhokama qilamiz!👇

👉 @uzpythonlogs
#discussion, #teamwork, #community, #faq


Репост из: UzPythonMeetup
Tez orada | Совсем скоро | Very soon

👉 @UzPythonMeetup


1. Ikki sonning yig'indisi

Topshiriq:
Berilgan butun sonlar qatoridan shunday ikki sonning indekslarini qaytaringki, ularning yig'indisi berilgan songa teng bo'lsin.
Har bir elementni faqat bir marta ishlata olasiz!
Misol:
raqamlar_qatori = [2, 7, 11, 15], berilgan_son = 9,
Chunki: raqamlar_qatori[0] + raqamlar_qatori[1] = 2 + 7 = 9,
Qaytadi: [0, 1].
Yechim:
class Solution:
... def twoSum(self, nums, target):
... """
... :type nums: List[int]
... :type target: int
... :rtype: List[int]
... """
... for index, current_value in enumerate(nums):
... searching_value = target - current_value
... try:
... searching_value_index = nums.index(searching_value, index + 1)
... if not searching_value_index > print(Solution().twoSum([1, 3, 4], 7))
[1, 2]

@uzpythonlogs
#algoritm #problem #solution #leetcode #contest #interview




Python'da Mover.uz'dan berilgan havola orqali video'ni yuklab olish usuli:

import requests
import os


class Parse:
"""
kiruvchi havola: https://mover.uz/watch/PUxFuoqm/
chiquvchi video 360: https://v.mover.uz/PUxFuoqm_m.mp4
chiquvchi video 720: https://v.mover.uz/PUxFuoqm_h.mp4
"""
https = 'https://v.mover.uz/'
q_360 = '_m.mp4'
q_720 = '_h.mp4'
q = {
'360': q_360,
'720': q_720
}
user_agent = {'User-agent': 'Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030529'}

def __init__(self, link):
self.link = link
self.quantity_list = []
self.movie_id = self.link.split('/')[-2] # PUxFuoqm

def search_movies(self):
quantity_360 = self.https + self.movie_id + self.q_360
quantity_720 = self.https + self.movie_id + self.q_720
self.processing_quantity(quantity_360, '360')
self.processing_quantity(quantity_720, '720')
return self.quantity_list

def processing_quantity(self, quantity, text):
res360 = requests.get(quantity, headers=self.user_agent)
if res360.status_code == 200:
self.quantity_list.append(text)

def uploads(self, list_uploads):
self.create_folder()
quantity = {
'360': self.https + self.movie_id + self.q_360,
'720': self.https + self.movie_id + self.q_720
}
for up in list_uploads:
res = requests.get(quantity[up], headers=self.user_agent)
with open(f"{os.getcwd()}/uploads/{up}_{quantity[up].split('/')[-1]}", 'wb') as f:
f.write(res.content)
return True

@staticmethod
def create_folder():
base_dir = os.getcwd()
list_dir = os.listdir(base_dir)
if 'uploads' not in list_dir:
try:
os.mkdir('uploads')
except OSError:
raise Exception("Uploads katalogini yaratib bo'lmadi, ruxsatni tekshiring")


if __name__ == "__main__":
parser = Parse('https://mover.uz/watch/PUxFuoqm/')
parser.uploads(parser.search_movies())

Rahmat: @alimanuz

@uzpythonlogs
#parsing #mover #videohavola #yuklabolish


Python'ning re moduli orqali matndan ma'lum shart asosida, matnning kerakli bo'lagini qirqib olish usulini - mover.uz'dagi video misolida ko'ramiz! Uni quyidagi funksiya orqali olish mumkin:


>>> url = 'https://mover.uz/watch/I2V2OKE/'
>>> import re
>>>
>>>
>>> def mover_video_url_getter(url):
... try:
... groups = re.search('https://mover.uz/watch/(.+?)/', url).groups()
... except Exception as e:
... print("Havola noto'g'ri berilgan")
... return
... else:
... if len(groups) > 0:
... video_name = groups[0]
... video_url = "https://v.mover.uz/{}_m.mp4".format(video_name)
... return video_url
... else:
... print('Mos havola topilmadi')
... return
...
>>> mover_video_url_getter(url)
'https://v.mover.uz/I2V2OKE_m.mp4'

Funksiyaning vazifasi: mover.uz'dagi biror videoga havolani berganda, funksiya video fayl turgan havolani qaytaradi.

@uzpythonlogs
#parsing #regex #videohavola


Lug'at(dictionary)ni qiymatlari asosida saralash usuli:

>>> lugat = {'shaharlar': 34, 'qishloqlar': 198, 'viloyatlar': 12}
>>> saralangan_lugat = dict(sorted(lugat.items(), key=lambda x: x[1]))
>>> print(saralangan_lugat)
{'viloyatlar': 12, 'shaharlar': 34, 'qishloqlar': 198}

@uzpythonlogs
#lugat #dictionary #lambda #saralash #sorting


Python3 ning ichki imkoniyatlaridan foydalanib oddiy web ilova ko'tarish mumkin (framework yoki kutubxona ishlatmasdan)!

Buning uchun biz http va socketserver modullaridan foydalanishimiz yetarli va u quyidagicha bo'ladi:


from http.server import SimpleHTTPRequestHandler
from http import HTTPStatus
from socketserver import TCPServer


class Handler(SimpleHTTPRequestHandler):
def do_GET(self):
path = self.path
if path == "/":
status = HTTPStatus.OK
content = b"Bosh sahifa"
else:
status = HTTPStatus.NOT_FOUND
content = b"Sahifa topilmadi"
self.send_response(status)
self.end_headers()
self.wfile.write(content)


if __name__ == "__main__":
ip_address, port = '127.0.0.1', 8000
httpd = TCPServer((ip_address, port), Handler)
print(f"Server ishga tushdi: http://{ip_address}:{port}")
httpd.serve_forever()

Tekshirib ko'rish uchun brovserda ochib ko'rish yoki curl'dan ham foydalanishimiz mumkin :

$ curl http://127.0.0.1:8000
Bosh sahifa

$ curl http://127.0.0.1:8000/yangiliklar
Sahifa topilmadi

@uzpythonlogs
#web_ilova #http #TcpServer


O'zgaruvchiga ajratilgan xotiradagi joyni aniqlash usuli(baytda):

>>> import sys
>>> mening_ozgaruvchim = 1938
>>> print(sys.getsizeof(mening_ozgaruvchim))
28

@uzpythonlogs
#xotira #sys #size #ozgaruvchi_hajmi


Ikki lug'at(dict) turdagi ma'lumotni birlashtirish usuli:

>>> birinchi_manba = {'soni': 9, 'yigindisi': 2}
>>> ikkinchi_manba = {'yigindisi': 3, 'ochirilganlari': 12}
>>> {**birinchi_manba, **ikkinchi_manba}
{'soni': 9, 'yigindisi': 3, 'ochirilganlari': 12}

@uzpythonlogs
#dict #lugat #birlashtirish #merge #dictionary_merge


So'zlardan tashkil topgan ro'yxatni, so'zlarni uzunligiga asosan saralash:

>>>matn_royxat = ["Bir", "Ikki", "Uch", "To'rt", "Besh"]
>>>matn_royxat = sorted(matn_royxat, key=len)
>>>print(matn_royxat)
['Bir', 'Uch', 'Ikki', 'Besh', "To'rt"]
@uzpythonlogs

#list #saralash #matn #string_list_sorting #sorted

Показано 20 последних публикаций.

60

подписчиков
Статистика канала