eol

Python serial (pySerial) Reading lines with EOL r instead of n

Python serial (pySerial) Reading lines with EOL r instead of n Question: I am communicating with an SR830 lock-in amplifier via an RS232 cable. When reading the data as in the following code: import serial def main(): ser = serial.Serial( port=’COM6′, baudrate=19200, parity=serial.PARITY_NONE, stopbits=serial.STOPBITS_ONE, bytesize=serial.EIGHTBITS) ser.timeout=1 ser.write(“OUTP? 1 rn”.encode()) #Asks the Lock-in for x-value ser.write(“++readrn”.encode()) …

Total answers: 3

Regular Expression to match cross platform newline characters

Regular Expression to match cross platform newline characters Question: My program can accept data that has newline characters of n, rn or r (eg Unix, PC or Mac styles) What is the best way to construct a regular expression that will match whatever the encoding is? Alternatively, I could use universal_newline support on input, but …

Total answers: 2