title: Python code for alarm clock
body: <p>I am writing a python code for implementing an alarm clock where I am putting some YouTube links in text file and the program will read the file. I have to set time whatever I want in any format and at that particular time program will pick a random link from those which are saved in the file and start playing.
  But in the if else part my program is falling in a infinite loop.</p>
  
  <p>Can anyone please review my code where I am doing mistakes.</p>
  
  <pre><code>import random
  import time
  import webbrowser
  
  from datetime import datetime
  import subprocess
  
  lines = open("C:\Python_code\Links.txt").read().splitlines()
  mylines = random.choice(lines)
  print(mylines)
  
  time_input = str(raw_input("Please enter the time in HH:MM:SS format: "))
  current_date = str(raw_input("Please enter the date in YYYY/MM/DD format: "))
  selected_time = datetime.strptime('%s %s'%(current_date, time_input),"%Y/%m/%d  %H:%M:%S")
  print "Time selected: ",selected_time
  
  while True:
    if selected_time == time.localtime():
        print "Alarm Now"
        webbrowser.open(mylines)
        break
    else:
        print "no alarm"
  </code></pre>