Convert String '321_1' to '321.1'.
I would like to create a method to convert the underscore to full stop. i used split but it cant work .. Anyone can help me? or must i use while loop
Convert underscore to fullstop
def Convert_toFullStop(text):
x1 = ""
words = text.split()
if words in ("_"):
words = "."
print words
use the replace() function?
newtext = text.replace('_','.')
I would do
def Convert_toFullStop(text):
return text.replace('_', '.')
and leave the print to the caller.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With