Skip to content

Added folder with my homework on regular expressions#6

Open
ibragimovaamina wants to merge 2 commits into
mainfrom
homework_regex
Open

Added folder with my homework on regular expressions#6
ibragimovaamina wants to merge 2 commits into
mainfrom
homework_regex

Conversation

@ibragimovaamina

Copy link
Copy Markdown
Owner

No description provided.

Comment thread hw5_regex/hw5_regex.py
# Task 2. Extracting all numbers from file:

with open('2430AD', 'r') as input_file:
pattern = r'\d+[\d.]*'

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Выражения типа IP зачтёт за число: 192.1.1.1
А ещё просто 1. (с точкой)
Не уверена, что это лучшая логика.

Comment thread hw5_regex/hw5_regex.py
# Task 4. Extracting all exclamatory sentences:

with open('2430AD', 'r') as input_file:
pattern = r'[\s.!?\"]+([A-Z]+[ \w\d]*!)'

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Поедложения могут начинаться с маленьких букв и цифр, а посередине иметь знаки препинания (запятые, тире, дефисы, точки с запятой).
Глобально я это за ошибку не засчитывала, но в данном случае не найдёт предложение из текста Think, Cranwitz! корректно - а это точно ошибка.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants