Click here to Skip to main content
15,881,882 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,

I am reading values from serial port, i need to put a line break on a specific character. How to achieve this.

What I have tried:

I have tried in displaying the data in terminal with timestamp. I need to split the data to next line and so on a specific set of character.
Posted
Updated 16-Nov-17 22:29pm

 
Share this answer
 
If the specific character is constant, you could save the data into a string and use the split method by specifying this character as the delimiter.
For example:
Python
>>data = "FF43//A64B//FFFF"
>>split_data = list(data.split("//"))


>>['FF43','A648','FFFF']
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900