This media is not supported in your browser
VIEW IN TELEGRAM
یه آموزش نسبتا کاربردی
با یه لایبرری داخلی پایتون
———————————
تو این آموزش با یکی از کتابخونه های داخلی خود پایتون (webbrowser) لینک وبسایتها رو داخل مرورگر باز کردیم
کاربردش کجا هست؟
مثلا شما یک برنامه ای ساختین و میخواین وقتی اجرا شد اون کاربر رو ببره به سایت شما یا داکیومنت اون برنامه که ساختین
-+-+-+-+--+-+-+-+-+-+-+-+-
A relatively practical tutorial
With an internal Python library
———————————
In this tutorial, we opened the link of websites in the browser with one of our internal Python libraries (webbrowser).
Where is it used?
For example, you created a program and you want to take that user to your site or the document of the program you created when it was executed.
با یه لایبرری داخلی پایتون
———————————
تو این آموزش با یکی از کتابخونه های داخلی خود پایتون (webbrowser) لینک وبسایتها رو داخل مرورگر باز کردیم
کاربردش کجا هست؟
مثلا شما یک برنامه ای ساختین و میخواین وقتی اجرا شد اون کاربر رو ببره به سایت شما یا داکیومنت اون برنامه که ساختین
-+-+-+-+--+-+-+-+-+-+-+-+-
A relatively practical tutorial
With an internal Python library
———————————
In this tutorial, we opened the link of websites in the browser with one of our internal Python libraries (webbrowser).
Where is it used?
For example, you created a program and you want to take that user to your site or the document of the program you created when it was executed.
https://fake-useragent.herokuapp.com/browsers/0.1.11
وب سرویس useragent فیک
تو یه لایبرری بود خواستین استفاده کنین
لایبرریشم این بود
fake-useragent
وب سرویس useragent فیک
تو یه لایبرری بود خواستین استفاده کنین
لایبرریشم این بود
fake-useragent
pip install fake-useragent
〽️ آموزش کانورت کردن سشن تلتون به سشن پایروگرام و برعکس
〽️ How to convert telethon session to pyrogram session and pyrogram session to telethon session (database session)
✅ https://gist.github.com/m0h4mad/70098530a028ef8233353783a0e19804#file-session_convertor-py
〽️ How to convert telethon session to pyrogram session and pyrogram session to telethon session (database session)
✅ https://gist.github.com/m0h4mad/70098530a028ef8233353783a0e19804#file-session_convertor-py
Programming
سلام دوستان امیدوارم حالتون خوب باشه❤️ امروز میخوام آموزش OCR (استخراج متن از تصویر) در هوش مصنوعی رو با پایتون یادتون بدم. (خیلی راحت در سه خط کد). خب برای اینکار طبق عکس اول٬ باید برید این صفحه گیتهاب و نرم افزار مربوط به OCR رو دانلود و نصب کنید در یک…
〽️ tesseract ocr on GNU/LINUX using python3
Installation guide on GNU/LINUX:
Step 1:
install tesseract program:
on ubuntu/debian:
install pytesseract library:
نحوه نصب در گنو لینوکس:
قدم اول:
نصب نرم افزار tesseract:
در اوبونتو/دبین:
نصب کتابخانه pytesseract:
Installation guide on GNU/LINUX:
Step 1:
install tesseract program:
on ubuntu/debian:
sudo apt-get install tesseract-ocr
on fedora:sudo dnf install tesseract
on arch:sudo pacman -Syu tesseract
Step 2:install pytesseract library:
pip3 install pytesseract
〽️ آموزش بیرون کشیدن متن از فایل عکس با پایتون در سیستم عامل گنو لینوکس:نحوه نصب در گنو لینوکس:
قدم اول:
نصب نرم افزار tesseract:
در اوبونتو/دبین:
sudo apt-get install tesseract-ocr
در فدورا:sudo dnf install tesseract
آرچ:sudo pacman -Syu tesseract
قدم دوم:نصب کتابخانه pytesseract:
pip3 install pytesseract
✅ @PySourcesor you can pass **kwargs as dict like this:
#setattr
#getattr
✅ @PySources
a = argument_to_property(**{"test":"test", "other_test":"test"})
#OOP#setattr
#getattr
✅ @PySources
How to generate a random password using python ⚡️
چگونه با پایتون پسورد رندوم درست کنیم ⚡️
#password
#string
#random
#security
✅ @PySources
چگونه با پایتون پسورد رندوم درست کنیم ⚡️
#password
#string
#random
#security
✅ @PySources
hurry.filesize is a good human readable file size module that help you to show byte sizes to users
hurry.filesize یک ماژول خوب برای نشان دادن سایز های بایتی به کاربران نرم افزار/سایت شما با خوانایی بالا
example:
#human_readable_filesize
#filesize
#byte
#byte_size
✅ @PySources
hurry.filesize یک ماژول خوب برای نشان دادن سایز های بایتی به کاربران نرم افزار/سایت شما با خوانایی بالا
example:
>>> # pip3 install hurry.filesize
>>> from hurry.filesize import size, alternative
>>> size(1024, system=alternative)
'1 KB'
>>> size(1024 * 1024 * 3, system=alternative)
'3 MB'
————————————————#human_readable_filesize
#filesize
#byte
#byte_size
✅ @PySources
installation:
usage:
دانلود فایل با پایتون با ساده ترین روش
pip install wgetusage:
from wget import download
url = "your url"
out = download(url)
print(out)
دانلود فایل با پایتون با ساده ترین روش
Programming
installation: pip install wget usage: from wget import download url = "your url" out = download(url) print(out) دانلود فایل با پایتون با ساده ترین روش
Streaming download using
🔗: https://gist.github.com/m0h4mad/34a56d41d44aedcd81ead8b60a83b53c
use
asyncio, aiohttp, aiofiles ⚡️:🔗: https://gist.github.com/m0h4mad/34a56d41d44aedcd81ead8b60a83b53c
use
asyncio.gather to download more asynchronouslyHow to use
چگونه با فایل هایی با پسوند
#config
#ini
#configparser
✅ @PySources
.ini files in python ⚡️چگونه با فایل هایی با پسوند
.ini در پایتون استفاده کنیم ⚡️#config
#ini
#configparser
✅ @PySources
How to use
چگونه از فایل هایی با پسوند
#yaml
✅ @PySources
.yaml files in python ⚡️چگونه از فایل هایی با پسوند
.yaml در پایتون استفاده کنیم ⚡️#yaml
✅ @PySources
from PIL import Image, ImageDraw, ImageFont~ how to write on images with python
def write(
text:str,
x_y:tuple,
color:tuple,
font_path:str, font_size:int,
file_input:str, file_output:str
) -> None:
img = Image.open(file_input)
draw = ImageDraw.Draw(img)
font = ImageFont.truetype(font_path, font_size)
draw.text(x_y, text, color, font)
img.save(file_output)
img.close()
~ نوشتن روی تصاویر با پایتون
استاد یه برنامه نویس باگ/ارور هاشه
Bugs/errors are masters of a programmer
Bugs/errors are masters of a programmer
Example of new python3 feature (match case)
🔗 https://docs.python.org/3/whatsnew/3.10.html#simple-pattern-match-to-a-literal
✅ @PySources
🔗 https://docs.python.org/3/whatsnew/3.10.html#simple-pattern-match-to-a-literal
✅ @PySources
New features related to type hints in python3 new version:
🔗 https://docs.python.org/3/whatsnew/3.10.html#new-features-related-to-type-hints
قابلیت جدید پایتون ۳ مربوط به تایپ هینت ها
🔗 https://docs.python.org/3/whatsnew/3.10.html#new-features-related-to-type-hints
قابلیت جدید پایتون ۳ مربوط به تایپ هینت ها