Avatar ·

Python 3.X Alterando os valores dos elementos da linha no ciclo

📁 python

Como alterar o valor do símbolo da linha no ciclo? Código:


def getDateTimePostfix():
    import datetime;
    dtValue = datetime.datetime.now();
    retValue = str(dtValue);
    for sym in retValue:
        if sym == ':':
            sym = '.'
    return retValue;

Estou tentando ajustar a data, eliminando os ":" , mas não consigo alterar caracteres individuais.

Ou é melhor fazer um ciclo deste tipo?

i = 0