Uz Python dev Logs | Stay at home


Channel's geo and language: not specified, not specified
Category: not specified


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

Related channels

Channel's geo and language
not specified, not specified
Category
not specified
Statistics
Posts filter


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


Video is unavailable for watching
Show in 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


Forward from: 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 last posts shown.

60

subscribers
Channel statistics