Sep-17-2021, 05:52 PM
open files like so, instead of embedded:
with open("ROTOR_EMR4_BY_R15.cdb", "r") as old_database, open("old_output.txt", "r+") as old_copy:Then, assuming that the "(3i9,6e21.13e3)" is alone by itself on a line:
for x in old_content: line = str(x) line = line.strip() if line == "(3i9,6e21.13e3)": ...You're probably including the line termination in your search, so won't match . That is the reason for the strip