After tweaking a python script that I've found online, I'm trying to make this script read a line from a text file and write it to the serial port ttyS0. The idea is that after the port receives the word "End", it is safe to write, or when it receives the word "Start", it is also safe (Start comes first, End comes after executing a line from the text file). Each instruction read from the text file (generated on a Windows PC, so does that mean \n\r ?) is written to the serial port with a CR character at the end. I'm sure my script isn't complete yet, but how do you add a CR character at the end of each transmission?

import serial
from time import sleep
import numpy as np

port = "/dev/ttyS0"
speed = 9600

data = np.genfromtxt("Read_File.txt",delimiter="\n")

ser = serial.Serial(port, speed, timeout=0)

print '\nStarting\n'

while True:
    Incoming_data = ser.readline(9999)
    if len(Incoming_data) > 0:
        if (Incomwhile loop pythoning_data.startswith('End')):