Skip to content

for review #42

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

dimamushalapugin
Copy link

No description provided.

Copy link

@krepysh krepysh left a comment

Choose a reason for hiding this comment

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

Принято. Можно что-то поулучшать, но и так ок.


replace_example = context.replace('.', '!')
print(replace_example)
with open('referat1.txt', 'w', encoding='utf-8') as new_f:
Copy link

Choose a reason for hiding this comment

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

здесь так же можно использовать as f, потому что область видимости предыдущего f только блок with

@@ -16,7 +16,17 @@ def main():
Эта функция вызывается автоматически при запуске скрипта в консоли
В ней надо заменить pass на ваш код
"""
pass
with open('referat.txt', 'r', encoding='utf-8') as f:
Copy link

Choose a reason for hiding this comment

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

Должно ок работать без указания кодировки. Если не указываешь кодировку - код чутьчуть универсальнее получается.

context = f.read()
print(len(context))
number_of_words = len(context.split())
print(f'Количество слов составляет - {number_of_words}')
Copy link

Choose a reason for hiding this comment

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

Попробуй выделить отдельные функции: read_file, write_file, process_file_content

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