title: How to edit a Python script?
body: <p>I'm finding difficulties trying to edit a working python script. </p>
  
  <p>I have 2 files: </p>
  
  <ol>
  <li>a .txt file that contains IDs</li>
  <li>a .fasta file that have Fasta sequences with their IDs. </li>
  </ol>
  
  <p>The aim of this script is to compare the 2 files and once an ID from the first file match a sequence and its ID from the second file, the output should be the ID, the full sequence and its ID. </p>
  
  <p>The script that I have here gets me the ID of the first file and the sequence text only without its ID, as an output. </p>
  
  <p><a href="https://i.stack.imgur.com/kAWuO.jpg" rel="nofollow noreferrer">enter image description here</a></p>
  
  <p>This is the script:</p>
  
  <pre><code>with open('uniprot_reviewed_taxonomy_9606.fasta', 'r') as f:
      for line in f.readlines():
          line = line.replace("\n", "")
          if line.startswith('&gt;'):
              full_name = line.split('|')
              accession_x = full_name[1]
              print(accession_x)
          else:
             print (line)
  
              with open('homosapiens_output1.txt', 'r') as f1:
                  for line1 in f1.readlines()[1:]:  # ignores the first line
                      line1 = line1.replace("\n", "")
  
                      full_name1 = line1.split(' ')
                      accession_y = full_name1[0].replace(" ", "")
                      accession_z = full_name1[1].replace(" ", "")
                      main_accession = accession_x + " " + accession_z + " " + accession_y + " " + line
  
                      if accession_x == accession_z:
                          print(main_accession)
  </code></pre>
  
  <p>So can you please help me by editing the script <strong>so can the output would be the ID, Fasta sequence and its ID?</strong> </p>