-3

Where I have to drag the file before the filter.This is my existing code:

input = open("first file.txt", "rt")
output = open("revised.txt", "wt")
for line in input:
  output.write(line.replace("Bob", "James").replace("Xavier", "Jake"))
input.close()
output.close()

Now, this works but I have to manually add "first file.txt" to python and the program doesn't search the computers files. How would I make the program automatically search the computers files? Attached is a photo of where I have to drag in case your confused.

wjandrea
  • 28,235
  • 9
  • 60
  • 81
Beginner
  • 13
  • 1

1 Answers1

3

You're not "adding files to Python". You're adding them to REPL.it's website, which have their own file-system, and is where the code reads the files from.

Since you are using an online web interface, there is no possible way to make it search your local computer's files.

If this is what you want, install Python and run your code locally.

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
  • If I want to send this program to someone will they have to have python installed? – Beginner Nov 14 '21 at 23:40
  • Not required. https://stackoverflow.com/questions/5458048/how-can-i-make-a-python-script-standalone-executable-to-run-without-any-dependen – OneCricketeer Nov 15 '21 at 03:18