Python Forum
reformatting text with comma separated numbers
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
reformatting text with comma separated numbers
#4
(May-06-2020, 08:09 AM)anbu23 Wrote: To remove commas use replace(",","")

how do i make that only remove the commas that are part of numbers and leave other commas where they are? how do i add spaces in front of the number to keep other columns correctly aligned?

(May-06-2020, 08:46 AM)DeaD_EyE Wrote: Do you mean output like this:

Output in console:

Rich does the formatting.
I guess there are also on pypi packages.

that appears to be focused on rsync. but, rsync is merely an example. when someone gives an example, don't focus the solution on that. that's why so many people don't like to give examples.

i generally need to do "foo 4,567,891 bar" -> "foo 4567891 bar". and this is just an example. any text can be in place of "foo" or "bar"?
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply


Messages In This Thread
RE: reformatting text with comma separated numbers - by Skaperen - May-06-2020, 08:21 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  sorting with numbers in text Skaperen 5 3,793 Jul-20-2021, 01:15 AM
Last Post: Skaperen

Forum Jump:

User Panel Messages

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