title: elif and functions python how to?
body: <p>I have this code </p>
  
  <pre><code>elif device_type == "7":
  print("\n")
  print("************************************")
  print("*****                          *****")
  print("*****   Comparision Checker    *****")
  print("*****    Of Two Configs        *****")
  print("************************************")
  print("\n")
  print('\nWARNING: Discrepancies found:')
  
  def open_file_and_return_list(file_path):
      list = []
      with open(file_path, 'r') as f:
          line = f.readline()
          while line:
              list.append(line)
              line = f.readline()
      return list
  
  
  def clean_new_line(list):
      for i in range(len(list)):
          if "\n" in list[i]:
              list[i] = list[i].replace("\n", "")
      return list
  
  
  if __name__ == "__main__":
      list1 = open_file_and_return_list(r"new.txt")
      list2 = open_file_and_return_list(r"standard.txt")
      maxl = max(len(list1), len(list2))
      list1 += [''] * (maxl - len(list1))
      list2 += [''] * (maxl - len(list2))
      diff = []
      diff_file = input("\nINFO: Select what to name the difference(s) : ")
      open(diff_file, 'w').close()
  
      for iline, (l1, l2) in enumerate(zip(list1, list2)):
          if l1 != l2:
              print(iline, l1, l2)
              print(iline, l1, l2, file=open(diff_file, 'a'))
  </code></pre>
  
  <p>When I use option 7, I obviously get this error. </p>
  
  <blockquote>
    <p>INFO:  Select Test: 7
    Traceback (most recent call last):</p>
    
    <p>File "C:/Users/a/a/a/pre-post-check-LATEST.py", line 866, in </p>
    
    <hr>
    
    <p>list1 = open_file_and_return_list(r"new.txt")
    *****                          *****
     File "C:/Users/a/a/a/pre-post-check-LATEST.py", line 850, in open_file_and_return_list
    *****   Comparision Checker    *****
    *****    Of Two Configs        *****</p>
    
    <hr>
  </blockquote>
  
  <p>How can I fix this issue, or obviously my logic is not right, how can i fix my logic?
  Thanks</p>