The logic you want is unclear, but look at the code below.
while True:
Word = raw_input() + '\n' # Take one line.
Locate end = word.find("Q0") # "Q0".
If end > -1: # If you found "Q0"
file.write(word[:end]) # Write only before "Q0".
break # Stop typing.
else: # If you didn't find it
infile.write(word) # Write all.
And when you upload the code, it's easier to answer by copying and pasting it, not by pictures.
555 GDB gets version error when attempting to debug with the Presense SDK (IDE)
555 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
777 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
554 Uncaught (inpromise) Error on Electron: An object could not be cloned
© 2024 OneMinuteCode. All rights reserved.