functools — Higher-order functions and operations on callable objects
partial gives default values to the parameters of a function that would otherwise not have default values.
#pytrick
partial gives default values to the parameters of a function that would otherwise not have default values.
#pytrick
Python's list comprehensions are awesome
even_squares = [x * x for x in range(10) if not x % 2]
#pytrick
even_squares = [x * x for x in range(10) if not x % 2]
#pytrick
روشی که برای تولید تمام حالت ها در brute-force پسوردها هم استفاده میشود!
itertools.permutations() generates permutations for an iterable.
#pytrick
itertools.permutations() generates permutations for an iterable.
#pytrick
#pytrick
پایتون 3 اجازه میدهد نام متغیرهای شما unicode باشند. اما باید حتما کاراکترهای مثل حروف باشند...
پایتون 3 اجازه میدهد نام متغیرهای شما unicode باشند. اما باید حتما کاراکترهای مثل حروف باشند...
#pytrick
استفاده از contextlib برای نادیده گرفته شدن exception ها در کد!
#contextlib
#exception
استفاده از contextlib برای نادیده گرفته شدن exception ها در کد!
import contextlib
with contextlib.suppress(FileNotFoundError):
os.remove('somefile.tmp')
#contextlib
#exception
Forwarded from Python_Labs🐍 (Alireza Akhavan)
functools — Higher-order functions and operations on callable objects
partial gives default values to the parameters of a function that would otherwise not have default values.
#pytrick
partial gives default values to the parameters of a function that would otherwise not have default values.
#pytrick
#pytrick
پیدا کردن آیتمی با بیشترین تکرار در لیست.
Find The Most Frequent Value In A List.
مطلب مشابه: https://t.me/PyLab/275
منبع
پیدا کردن آیتمی با بیشترین تکرار در لیست.
Find The Most Frequent Value In A List.
مطلب مشابه: https://t.me/PyLab/275
منبع