How to receive a string from my Arduino Uno with pySerial?

I’m working on a project where my computer sends me data from my gmail account. if I get an new mail (or have an unread email) this python script sends my Arduino Uno an int with value 1 otherwise an int with value 0.

Now i need my Arduino to send some strings back to my pc. I am doing this with Serial.println("");

The problem with my code is when i run it with

serial_line = ser.readline()

my code doesn’t grab the unread emails anymore. Anybody know how to solve this?

Here’s the full python script:

import imaplib, serial #import modules

ser = serial.Serial('COM3', 9600) #create serial object, enter in the proper port 
obj = imaplib.IMAP4_SSL('') #create imap object, set to gmail
obj.login('', 'xxxxxx') #enter in gmail credentials

#runs continuously 
while 1: #refresh 
        val = len(, 'UnSeen')[1][0].split()) #generate a value of 1 or 0
        #print "The val is: %s\n" %  val #print value to monitor
        ser.write(str(val)) #write value to serial port
        serial_line = ser.readline()

This Python - Arduino demo may be helpful.