Editing a file with non .txt extension from python

59 views Asked by At

I am trying to read a file with the extension .wbjn (ANSYS Workbench journal file) with basically contains python code per se, from python and change some information in it. But python does not recognize the .wbjn file, so I had to rename the .wbjn to .txt and make the changes.

But the problem with this approach is that when I trying to save the .txt extension back to .wbjn, the contents of the file is erased.

How do I do this in a better way ? Is there a library to read files with such extensions or is there another logic to solve this problem ?

0

There are 0 answers