HOW TO SEND OR RECEIVE SERIAL DATA IN PYTHON USING XCTU OR TO ARDUINO

SENDING

import serial
"""download library file from
https://pypi.python.org/pypi/pyserial """
ser = serial.Serial(port='com2',baudrate=9600)
             #enter comport name,baud rate
ser.close() #closes previously open serial port
ser.open()  # opens serial port
ser.write('hai') # sends a letter
ser.write(chr(0x22)) #sends an ascii number
ser.close()

RECEIVING

import serial
"""download library file from
https://pypi.python.org/pypi/pyserial """
ser = serial.Serial(port='com2',baudrate=9600)
             #enter comport name,baud rate
ser.close() #closes previously open serial port
ser.open()  # opens serial port
ser.write('send data') # sends a letter
x = ser.read()#reads the data .
print x

ser.close()