Ask coding questions

← Back to all posts
Import Python Input

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 (189)
[earned 5 cycles]
View Answer

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