@Eternalanquan · Post #1685 · 18.02.2026 г., 03:48
day1 in mobile security #learn
Hashtags
TGINSIGHT SIMILAR POSTS
Изворен канал @pythonotes · Post #146 · 16 сеп.
Функция sub в regex может принимать функцию в качестве аргумента repl. 📄 Из документации: If repl is a function, it is called for every non-overlapping occurrence of pattern. The function takes a single match object argument, and returns the replacement string. То есть для каждого совпадения будет вызвана функция для вычисления замены вместо замены на одну и ту же строку для всех совпадений. Иными словами, для замены разных совпадений на разные строки не потребуется запускать re.sub() много раз для каждой строки замены. Достаточно определить функцию, которая вернёт строку для каждого из совпадений. Описание слишком запутанное🤔, давайте лучше рассмотрим на простом примере: Создаем карту замены. То есть какие строки на какие требуется менять. remap = { 'раз': '1', 'два': '2', 'три': '3', 'четыре': '4', 'пять': '5', } Пишем функцию поиска строки для замены. Единственным аргументом будет объект re.Match. Используя данные этого объекта мы вычисляем замену on-the-fly! def get_str(match: re.Match): word = match.group(1) return remap.get(word.lower()) or word Пример текста. text = '''Раз Два Три Четыре Пять Вместе будем мы считать Пять Четыре Три Два Раз Мы считать научим вас ''' Теперь запускаем re.sub и вместо строки замены (repl) подаём имя функции. (Данный паттерн ищет отдельные слова в тексте) >>> print(re.sub(r'(\w+)', get_str, text)) 1 2 3 4 5 Вместе будем мы считать 5 4 3 2 1 Мы считать научим вас Думаю, достаточно наглядно 🤓 #libs#regex
Пребарај: #learn
@Eternalanquan · Post #1685 · 18.02.2026 г., 03:48
day1 in mobile security #learn
Hashtags
@arkibug · Post #442 · 17.05.2022 г., 06:10
A fun and colorful explanation of how DNS works. https://howdns.works english - episode 1🖼 es - de - fr #learn
Hashtags
@djangoproject · Post #545 · 11.01.2018 г., 14:08
https://online.dr-chuck.com/about.php This is the web site of the "University of Dr. Chuck". I teach a number of free/online/open courses based on free and open materials and this site is the course catalog for my free courses. #learn#python
@djangoproject · Post #524 · 17.12.2017 г., 16:42
https://python.swaroopch.com/ A Byte of #Python "A Byte of Python" is a free book on programming using the Python language. It serves as a tutorial or guide to the Python language for a beginner audience. If all you know about computers is how to save text files, then this is the book for you. #learn
@djangoproject · Post #486 · 31.10.2017 г., 19:49
https://intellipaat.com/tutorial/python-tutorial/ This #Python free tutorial is for beginners as an introduction to learn this powerful programming language. #learn
@djangoproject · Post #432 · 07.09.2017 г., 09:30
# In Python 3.4+ you can use # contextlib.suppress() to selectively # ignore specific exceptions: import contextlib with contextlib.suppress(FileNotFoundError): os.remove('somefile.tmp') # This is equivalent to: try: os.remove('somefile.tmp') except FileNotFoundError: pass # contextlib.suppress docstring: # # "Return a context manager that suppresses any # of the specified exceptions if they occur in the body # of a with statement and then resumes execution with # the first statement following the end of # the with statement." #python#learn
@djangoproject · Post #412 · 15.08.2017 г., 05:11
https://intellipaat.com/tutorial/python-tutorial/ Often, programmers fall for Python because of its minimum compilation time and speedier edit-test-debug cycle. Python is a go-programming language that has automated the way programmers code. This is indeed one of the major reasons developers have switched their interest to Python programming language. It helps you write simple scripts at relatively faster rate compared to Java, C, C++ . Get #Python Certification in just 16 Hours GET CERTIFIED #learn
@djangoproject · Post #284 · 31.03.2017 г., 06:53
http://docs.python-guide.org/en/latest/ Greetings, Earthling! Welcome to The Hitchhiker’s Guide to Python. This is a living, breathing guide. If you’d like to contribute, fork us on GitHub! This handcrafted guide exists to provide both novice and expert Python developers a best practice handbook to the installation, configuration, and usage of Python on a daily basis. This guide is opinionated in a way that is almost, but not quite, entirely unlike Python’s official documentation. You won’t find a list of every #Python web framework available here. Rather, you’ll find a nice concise list of highly recommended options. #learn
@djangoproject · Post #190 · 30.10.2016 г., 07:40
http://www.python-course.eu/finite_state_machine.php #learn#python
@tomoko_channel · Post #1700 · 01.05.2026 г., 04:16
5月决定就是: Complete CS146S "The Modern Software Developer" | 在一个月内完成「The Modern Software Developer」课程。 🌟🎉 恭喜恭喜!!! (2026-05-01 传送门) #learn#random_todolist
Hashtags
@tomoko_channel · Post #472 · 12.06.2024 г., 06:07
6月决定就是: Math | 数学基础 | 例如可以每天看一下 3Blue1Brown 的视频 🌟🎉 恭喜恭喜!!! (2024-06-12 传送门) #learn#random_todolist
Hashtags
@TFGames · Post #1714 · 28.12.2023 г., 20:51
#LEARN#BATTLE https://testflight.apple.com/join/zxzIw9a5