I would like to open a .pas file in Python, ( Generally, I can open the .pas by Text Editor to see what is inside). So, I am looking for the code to open and edit the file in Python. To more clear, I would like to edit some variables in the file. So first I need to open it and then edit the file.
Advertisement
Answer
You can use the builtin open()
function to open a text file:
with open('file.pas', mode='r') as f: print(f.read())
Here are the docs