R
R
Renat Ataev2020-08-06 13:18:04
Python
Renat Ataev, 2020-08-06 13:18:04

Change number string 1000 to 1.000?

Good afternoon. I would like to know how you can change the number string of the number 1000 to 1.000.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Alexander, 2020-08-06
@fanepka

txt = "1000"

x = txt.replace("1000", "1.000")

print  (x)

A
Andrey, 2020-08-06
@anerev

a = '1000'
print(a[0] + '.' + a[1:])

A
Artur, 2020-08-07
@rackev

import re

print(re.sub(r'(?<!^)(?=(\d{3})+$)', r'.', "12345673456456456"))

#Output:  12.345.673.456.456.456

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question