file input python
# import fileinput
import fileinput
# Using fileinput.input() method
for line in fileinput.input(files ='gfg.txt'):
print(line)
file input python
# import fileinput
import fileinput
# Using fileinput.input() method
for line in fileinput.input(files ='gfg.txt'):
print(line)
how to write user input to a file in python
#Print User Input to A File
x = input("Enter blah : ")
y = open('C:UsersUSERNAMEDocumentsDoc1.txt', 'w')
y.write(x)
#Convert text to binary and then write to file
x = input("Enter blah : ")
y = open('C:UsersUSERNAMEDocumentsDoc1.txt', 'wb')
y.write(x)
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us