Re: Easiest way to calculate number of character in string

2005-12-21 Thread Bengt Richter
On 21 Dec 2005 15:57:35 +0100, Ove Svensson <[EMAIL PROTECTED]> wrote: >Ove Svensson <[EMAIL PROTECTED]> writes: > >> "P. Schmidt-Volkmar" <[EMAIL PROTECTED]> writes: >> >> > Hi there, >> > >> > I have a string in which I want to calculate how often the character ';' >> > occurs. If the charac

Re: Easiest way to calculate number of character in string

2005-12-21 Thread Ove Svensson
Ove Svensson <[EMAIL PROTECTED]> writes: > "P. Schmidt-Volkmar" <[EMAIL PROTECTED]> writes: > > > Hi there, > > > > I have a string in which I want to calculate how often the character ';' > > occurs. If the character does not occur 42 times, the ";" should be added > > so > > the 42 are rea

Re: Easiest way to calculate number of character in string

2005-12-21 Thread Ove Svensson
"P. Schmidt-Volkmar" <[EMAIL PROTECTED]> writes: > Hi there, > > I have a string in which I want to calculate how often the character ';' > occurs. If the character does not occur 42 times, the ";" should be added so > the 42 are reached. > > My solution is slow and wrong: > for Position

Re: Easiest way to calculate number of character in string

2005-12-21 Thread Kent Johnson
P. Schmidt-Volkmar wrote: > Hi there, > > I have a string in which I want to calculate how often the character ';' > occurs. If the character does not occur 42 times, the ";" should be added so > the 42 are reached. > > My solution is slow and wrong: > > How can this be achieved easily? Is t

Re: Easiest way to calculate number of character in string

2005-12-21 Thread Lawrence Oluyede
Il 2005-12-21, P. Schmidt-Volkmar <[EMAIL PROTECTED]> ha scritto: > Hi there, > > I have a string in which I want to calculate how often the character ';' > occurs. If the character does not occur 42 times, the ";" should be added so > the 42 are reached. > > My solution is slow and wrong: >

Re: Easiest way to calculate number of character in string

2005-12-21 Thread claude . henchoz
should = 42 has = Zeile.count(';') if has < should: Zeile += ";"*(should - has) cheers, claude -- http://mail.python.org/mailman/listinfo/python-list

Re: Easiest way to calculate number of character in string

2005-12-21 Thread Carsten Haese
On Wed, 2005-12-21 at 09:03, P. Schmidt-Volkmar wrote: > Hi there, > > I have a string in which I want to calculate how often the character ';' > occurs. If the character does not occur 42 times, the ";" should be added so > the 42 are reached. > > My solution is slow and wrong: > for Posi

Easiest way to calculate number of character in string

2005-12-21 Thread P. Schmidt-Volkmar
Hi there, I have a string in which I want to calculate how often the character ';' occurs. If the character does not occur 42 times, the ";" should be added so the 42 are reached. My solution is slow and wrong: for Position in range (0, len(Zeile)): if Zeile[Position]==';': AnzahlS