-1

If I have a standard txt file and I'm reading it in using either FileInputStream or FileReader, how can I convert that into a .py file using Java?

Broots Waymb
  • 4,713
  • 3
  • 28
  • 51

1 Answers1

1

You don't have to read the file. All you have to do is change the file name:

File txtFile = new File("somefile.txt");
File pyFile = new File("somefile.py");
txtFile.renameTo(pyFile);
Code-Apprentice
  • 81,660
  • 23
  • 145
  • 268