Home > Enterprise >  How to split only "±" in a python string?
How to split only "±" in a python string?

Time:10-05

How to convert the "±" into " -" or vice versa in a python string?

For example I have this string 18.1±0.3% hemolysis at 50µM and only want to split ± in this string -.

CodePudding user response:

This is not splitting. You call it so, because, graphically, it looks that way. But there is not other relation (other than appearance in your fonts) between '±' and ' ' and '-'.

So what you are looking for, is just good, old, pattern search and replace.

mystring.replace('±', ' -')
  • Related