Skip to content
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

Homework 2 is done #40

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

Conversation

justatrade
Copy link

No description provided.

try:
with open('referat.txt', 'r', encoding='UTF-8') as read_file:
while True:
line = read_file.readline()

Choose a reason for hiding this comment

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

можно сразу все прочитать. Но это не очень хорошо для больших файлов

if not line:
break
else:
read_string += line

Choose a reason for hiding this comment

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

Просто ты все равно весь контент в файла в память сохраняешь, так что смысла чиать по строке мало

try:
with open('referat2.txt', 'w', encoding='UTF-8') as write_file:
write_file.write(read_string.replace('.', '!'))
except (IOError, FileNotFoundError) as e:

Choose a reason for hiding this comment

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

круто что ошибки обрабатываешь

writer.writerow(each)
except (IOError, FileNotFoundError) as e:
print(e)
pprint.pprint(dict_list)

Choose a reason for hiding this comment

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

О знаешь про это принт, он очень удобный для больших объектов

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