1 votes

Python external .txt file error

Hello, good morning, I have this problem, the program does not generate the external .txt file, what could be the error?

 from io import open 

archivo_externo=open("primerArchivo.txt","w")

enter the description of the image here

1voto

mourazo Points 86

To create the file in python you should only use the open function since as they say above this function is native to python:

 file = open("C:/mosquitto/code/tuarchivo.txt", "w")
file.write("Hello world");
print("archivo creado...")
file.close()

HolaDevs.com

HolaDevs is an online community of programmers and software lovers.
You can check other people responses or create a new question if you don't find a solution

Powered by:

X