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]==';': AnzahlSemikolon = AnzahlSemikolon +1
    if AnzahlSemikolon < 42:
        for Zaehler in range(AnzahlSemikolon, 42):
            Zeile = Zeile + ';'
        Dreckskram = Dreckskram +1

How can this be achieved easily?

Thanks,

Pascal 


-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to