Created
          January 26, 2014 00:37 
        
      - 
      
- 
        Save Siddhartha90/8626142 to your computer and use it in GitHub Desktop. 
    another script to pull out movie from the movies.dat file
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | def main(): | |
| myfile = open('result.txt', 'r') | |
| myfile2 = open('movies.txt', 'r') | |
| myfile3 = open('finalrecos.txt', 'w') | |
| content = myfile2.read() | |
| i = 0 | |
| for line in myfile: | |
| m = re.search(r'(?<=RecommendedItem\[item:)(\d+)',line) | |
| i+=1 | |
| n = re.search(r'(?<='+m.group(0)+r'\:\:)(.+)(?=::)',content) | |
| myfile3.write('User ' + str(i) + ' will like the movie "') | |
| myfile3.write(n.group(0)) | |
| myfile3.write('" the best\n') | |
| main() | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment