Ask coding questions

← Back to all posts
Import Python Input
IzanLarumbe (28)

Hi, i have a little question, how can i import a python input to a text file?
Ej: I = input("Your text") ---> File.txt contains "Your text".

Answered by Geocube101 (202) [earned 5 cycles]
View Answer
Geocube101 (202)

You can write to a file without external modules

f = open('yourfile.txt', 'w') #Open File to Write
f.write('writestuff') #Write a String
f.close() #Close File

Check out more about opening files here