SHARE
TWEET

Problema 5

a guest Nov 17th, 2019 73 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def findDNA(fileOfDNA, DNA):
  2.   #@param fileOfDNA: string; Path del file contenente il DNA dei batteri
  3.   #@param DNA: string; DNA da ricercare nel file
  4.  
  5.   file = open(fileOfDNA, "rt")
  6.   readFile = file.read()
  7.   file.close()
  8.  
  9.   search(readFile, DNA)
  10.  
  11.  
  12. def search(readFileDNA, stringDNA):
  13.   #@param readFileDNA: string;
  14.   #@stringDNA: string;
  15.   #@return bool;
  16.  
  17.   indexDNA = readFileDNA.find(stringDNA)
  18.  
  19.   if indexDNA != -1:
  20.     stamp(readFileDNA, indexDNA)
  21.     return true
  22.   else:
  23.     return false
  24.    
  25.      
  26. def stamp(file, index):
  27.   #@file: string;
  28.   #@index: int;
  29.   #@return string;
  30.  
  31.   arrow = file.rfind(">", 0, index)
  32.   backspace = file.find("\n", arrow)
  33.   name = file[arrow + 1 : backspace - 2]  
  34.   return name
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top