Just checking if I'm doing correctly

homework
python

#1

Hello everyone,

I need a little help with the simple program in Python.
So the program I currently create must open the .txt file, find and replace
the specific word (or couple of words)
with some other words. For example, if there is a text that contains
word "House", I want that program to change that word "House" to
"Street". After that program needs to save that .txt file and close it.

My question is, which module I need to import to work with this kind of tasks?

I just want to make sure that Im doing this right, so any help is acceptable.


#2

Is it allowed we help you with your homework?


#3

I'd call this "research"

Anyway, Google is how you find this stuff out.

"python read text file"
"python replace words"

or just about any similar search phrases

Nobody remembers all this stuff, all you need to learn is how to find it.


#4

You could this without importing any module, but if you really want to import one, use re which stands for: regular expression.

Reading and writing of a text file is supported in python without having to import anything