Avatar ·

Python 3.x Cambio de valores de elementos de cadena en un bucle

📁 python

¿Cómo cambiar el valor de un carácter de una cadena en un bucle? Código:

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

Estoy intentando ajustar la fecha, eliminando los "":"", pero no logro cambiar los caracteres individuales.

¿O es mejor hacer un bucle de este tipo?

    i = 0;    for item 

                    
                
Avatar ·

La utilidad py es un lanzador que, mediante parámetros de línea de comandos, permite ejecutar la versión deseada de Python (de las instaladas en este equipo). Ayuda sobre esta utilidad:

C:\\Users\\User>py --helpPython Launcher for Windows Version 3.8.1150.1013usage:py [launcher-args] [python-args] script [script-args]Launcher arguments:-2     : Launch the latest Python 2.x version-3     : Launch the latest Python 3.x version-X.Y   : Launch the specified Python version     The above all default to 64 bit if a matching 64 bit python is present.-X.Y-32: Launch the specified 32bit Python version-X-32  : Launch the latest 32bit Python X version-X.Y-64: Launch the specified 64bit Python version-X-64  : Launch the latest 64bit Python X version-0  --list       : List

Inicia sesión para dejar una respuesta

Blogs