When I try to read the file using this code , It gives me an error saying Syntax Error.
import os
import sys
def main(argv):
bada_file = os.path.join(os.path.dirname(__file__),argv[0],argv[1],)
print(os.path.abspath(__file__))
print(os.path.abspath(bada_file))
data_list = list()
with open(bada_file, "r+") as read_file:
# (1, "first test"), (2, "next_line") ...
for line in enumerate(read_file.readlines()):
print(line)
for data in data_list:
print(data)
if __name__ == "__main__":
main(sys.argv[1:])
The file that I am trying to read is ".OPF".
Is anyone have any suggestions please let me know. It will be really helpful. Thanks you.