title: Python Comparing two lists of strings for similarities
body: <p>I'm very new at Python but I thought it would be fun to make a program to sort all my downloads, but I'm having a little trouble with it. It works perfectly if my destination only has one word in it but if the destination has two words or more this is where it goes wrong and the program gets stuck in a loop. Does anybody have a better idea to compare the lists than me</p>
  
  <pre><code>&gt;&gt;&gt;for i in dstdir:
  &gt;&gt;&gt;    print i.split()
  
  ['CALIFORNICATION']
  ['THAT', "'70S", 'SHOW']
  ['THE', 'BIG', 'BANG', 'THEORY']
  ['THE', 'OFFICE']
  ['DEXTER']
  ['SPAWN']
  ['SCRUBS']
  ['BETTER', 'OF', 'TED']
  
  &gt;&gt;&gt;for i in dstdir:
  &gt;&gt;&gt;    print i.split()
  ['Brooklyn.Nine-Nine.S01E16.REAL.HDTV.x264-EXCELLENCE.mp4']
  ['Revolution', '2012', 'S02E12', 'HDTV', 'x264-LOL[ettv]']]
  ['Inequality', 'for', 'All', '(2013)', '[1080p]']
  </code></pre>
  
  <p>This is an example of the lists output.</p>
  
  <p>I have a destination directory with only folders in it and a download directory. I want to make a program to automatically look at the source file name and then look at the destination name. if the destination name is in the source name then I have the yes to go ahead and copy the downloaded file so it is sorted in my collection.</p>
  
  <pre><code>destination = '/media/mediacenter/SAMSUNG/SERIES/'
  source = '/home/mediacenter/Downloads/'
  dstdir = os.listdir(destination)
  srcdir = os.listdir(source)
  
  for i in srcdir:
      source = list(i.split())
      for j in dstdir:
          count = 0
          succes = 0
          destination = list(j.split())
          if len(destination) == 1:
              while (count &lt; len(source)):
                  if destination[0].upper() == source[count].upper():
                      print 'succes ', destination, ' ', source
                  count = count + 1
          elif len(destination) == 2:
              while(count &lt; len(source)):
                  if (destination[0].upper() == source[count].upper()):
                      succes = succes + 1
                      count = len(source)
              count = 0
              while(count &lt; len(source)):
                  if (destination[1].upper() == source[count].upper()):
                      succes = succes + 1
                      count = len(source)
              count = 0
              if succes == 2:
                  print 'succes ', destination, ' ', source
  </code></pre>
  
  <p>For now I'm happy with only "success" as an output; I will figure out how to copy files as it will be a totally different problem for me in the near future</p>