
Marcos Gomez
PreguntaPuedo guardar un mensaje escrito por un input en el archivo txt?

fidel angel ochoa
que buen aporte!!

Omar Daniel Centeno
Hola
Claro que sí, puedes utilizar el comando
with open
"w"
Quedaría de la siguiente manera:
with open("./mi_archivo.txt", "w", encoding="utf-8") as file: mensaje = input("Escribe el mensaje que quieras guardar: ") file.write(mensaje)