-
Notifications
You must be signed in to change notification settings - Fork 211
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
base: master
Are you sure you want to change the base?
Conversation
try: | ||
with open('referat.txt', 'r', encoding='UTF-8') as read_file: | ||
while True: | ||
line = read_file.readline() |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
О знаешь про это принт, он очень удобный для больших объектов
No description provided.