title: Waiting for incoming serial communication data Python
body: <p>I am trying to make a program which run serial communication with another program in python. In my program, I want to wait a specific incoming data. So far, I have successfully done it with this command :</p>
  
  <pre><code>while ser.read(length)!= incoming_data:
      pass
  </code></pre>
  
  <p>But the incoming_data has various possibility. I want to check what data is coming and do a specific task for each incoming data. In tera term macro I can use this code:</p>
  
  <pre><code>wait data1 data2
  if result = 1 then .....
  if result = 2 then ....
  </code></pre>
  
  <p>How can I do the same thing in python serial? because each data has different length. Thanks in advance.</p>