title: Python : While True or False
body: <p>I am not an experienced programmer, I have a problem with my code, I think it's a logical mistake of mine but I couldn't find an answer at <a href="http://anh.cs.luc.edu/python/hands-on/3.1/handsonHtml/whilestatements.html" rel="nofollow">http://anh.cs.luc.edu/python/hands-on/3.1/handsonHtml/whilestatements.html</a> .
  What I want is to check if the serial device is locked, and the different between conditions that "it is locked" and "it isn't locked" is that there are 4 commas <code>,,,,</code> in the line which contains <code>GPGGA</code> letters. So I want my code to start if there isn't <code>,,,,</code> but I guess my loop is wrong. Any suggestions will be appreciated. Thanks in advance.</p>
  
  <pre><code>import serial
  import time
  import subprocess
  
  
  file = open("/home/pi/allofthedatacollected.csv", "w") #"w" will be "a" later
  file.write('\n')
  while True:
      ser = serial.Serial("/dev/ttyUSB0", 4800, timeout =1)
      checking = ser.readline();
      if checking.find(",,,,"):
          print "not locked yet"
          True
      else:
          False    
          print "locked and loaded"
  </code></pre>
  
  <p>.
  .
  .</p>