title: How to check if file with same name exists with different extensions using Python
body: <p>I'm fairly new with files and currently writing method where I could pass file.pom path and check if .jar files exists in the same path.</p>
  
  <pre><code>def get_file_type(self, file_path):
      return pathlib.Path(file_path).suffix
  
  def check_if_file_exists(self, pom_file_path, extension):
      pom_file_extract_file = str(pom_file_path).rpartition("/")
      pom_file_extract_filename = str(pom_file_extract_file [-1]).rpartition("-")
      if pom_file_extract_filename ... # stuck
  
  ....
  
  for file in files:
      f = os.path.join(zip_path, file)
          f_fixed = "." + f.replace("\\", "/")
          if self.get_file_type(f_fixed) == ".pom":
              pom_paths = (root + "/" + file).replace("\\", "/")
              print(pom_paths)
  
              # if self.check_if_file_exists(pom_paths, ".jar") == True:
              #     Do stuff...
  </code></pre>
  
  <p>Should I pass the dir of pom?</p>