Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Newbie] Multiple Array
#1
Hello, im just new in this python language,
Im seeking some advice or help on return value
My situation / scenario is like this :
im currently working with communication port and the device sending 2 value at a time in 2 line
so how can i manipulate the output ( result ) to be as 1 line , as example :
- current value :
XA123
XB124

to be XA123,XB124 like this..

thanks in advance..
Reply
#2
Assuming a string object:

string = 'XA123\nXB124'

print(string)
print(string.replace('\n', ','))
Output:
XA123 XB124 XA123,XB124
Sig:
>>> import this

The UNIX philosophy: "Do one thing, and do it well."

"The danger of computers becoming like humans is not as great as the danger of humans becoming like computers." :~ Konrad Zuse

"Everything should be made as simple as possible, but not simpler." :~ Albert Einstein
Reply
#3
Thank you @rob101
rob101 likes this post
Reply
#4
Hi @Iusyanse , feel free to sent me pm
buran write Jun-01-2023, 05:58 AM:
The post by @Iusyanse was just a tool to post hidden spam links, so they were purged.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Multiple conditions when indexing an array with or without np.where noob2305 1 2,681 Oct-25-2020, 02:06 PM
Last Post: jefsummers
  Newbie question to use lambda on multiple columns of a dataframe zydjohn 0 5,819 Jan-23-2018, 06:08 PM
Last Post: zydjohn

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020