Using PySerial I was successful in sending data from Raspberry Pi Pico to Windows PC but not the other way around.
Windows PC code:
import serial
# Configure the serial connection
port = "COM5"
ser = serial.Serial(port, 9600)
message = b"Hey This is the message!!!!"
ser.write(message)
Raspberry Pi Pico code:
file = open('Results77.txt', 'wb')
while (True):
# I do not know what to do here to get the message that I sent into the variable data
data = input()
file.write(data)