Re: 3 number and dot..



On Oct 31, 10:18 pm, Paul McNett <p...@xxxxxxxxxxxx> wrote:
Abandoned wrote:
Hi..
I want to do this:
for examle:
12332321 ==> 12.332.321

How can i do?

Assuming that the dots are always in the 3rd and 7th position in the string:

def conv(s, sep="."):
l = [s[0:3], s[3:6], s[6:]]
return sep.join(l)

print conv("12332321")

--
pkm ~http://paulmcnett.com

But it's starts from the end..
print conv("12332321")
123.323.21
This is wrong it would be 12.332.321

.



Relevant Pages

  • Re: 3 number and dot..
    ... for examle: ... Assuming that the dots are always in the 3rd and 7th position in the string: ... pkm ~ http://paulmcnett.com ...
    (comp.lang.python)
  • Re: 3 number and dot..
    ... for examle: ... Assuming that the dots are always in the 3rd and 7th position in the string: ... If you're doing this for thousands separators, look at the locale module: ...
    (comp.lang.python)
  • Re: string manipulation
    ... What does it mean when both numbers have the same number of digits? ... The dots have no meaning,its just the way the data was entered,using the ... > Dim strAll As String ... > Dim strFirst As String ...
    (microsoft.public.access.modulesdaovba)
  • Re: string manipulation
    ... And what do the various numbers of dots mean? ... Dim strAll As String ... Dim strFirst As String ... Dim strSecond As String ...
    (microsoft.public.access.modulesdaovba)
  • Problems with Replace Method
    ... I am loading a CSV file into a Richtext box. ... The small a with two dots over it and the small y with two dots over it. ... Dim str As String = RichTextBox1.Text ... 'Dim arr() As String = str.Split, ...
    (microsoft.public.dotnet.languages.vb)