/
ilya.petrash
/
SimplePyScripts
Обзор
Документация
Войти
/
ilya.petrash
/
SimplePyScripts
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
regexp_examples/remove_punctuation.py
19 строк
425 B
gil9red
Refactoring. Using black code style
14 июн 2023, 12:20
14 июн 2023, 12:20
a869168
Код
Авторство
О чём код?
#!/usr/bin/env python3 # -*- coding: utf-8 -*- __author__ = "IPETRASH" import re import string def remove_punctuation(text): pattern = re.compile("[%s]" % re.escape(string.punctuation)) return pattern.sub("", text) if __name__ == "__main__": text = "classes, freq = defaultdict(lambda:0), defaultdict(lambda:0)" print(remove_punctuation(text)) # classes freq defaultdictlambda0 defaultdictlambda0