World's Best AI Learning Platform with profoundly Demanding Certification Programs
Designed by IITians, only for AI Learners.
Internship Partner

In Association with
In collaboration with



Designed by IITians, only for AI Learners.
Internship Partner
In Association with
In collaboration with
New to InsideAIML? Create an account
Employer? Create an account
Designed by IITians, only for AI Learners.
Internship Partner
In Association with
In collaboration with
Enter your email below and we will send a message to reset your password
Designed by IITians, only for AI Learners.
Internship Partner
In Association with
In collaboration with
By providing your contact details, you agree to our Terms of Use & Privacy Policy.
Already have an account? Sign In
Designed by IITians, only for AI Learners.
Internship Partner
In Association with
In collaboration with
By providing your contact details, you agree to our Terms of Use & Privacy Policy.
Already have an account? Sign In
Download our e-book of Introduction To Python
4.5 (1,292 Ratings)
589 Learners
Sulochana Kamshetty
2 years ago
# a file named
"insideaiml", will be opened with the reading mode.
file = open('inisdeaaiml.txt', 'r')
file = open("insideaiml.text", "r")
print (file)
file = open("file.txt","r")
print(file.read(5))
file = open('insideaiml.txt','w')
file.write("This is the write command")
file.write("It allows us to write in a particular file")
file.close()
file = open('insideaiml.txt','a')
file.write("This will add this line")
file.close()
with open("file.txt", "w") as f:
f.write("Hello World!!!")
split() using file handling
with open("file.text", "r") as file:
data = file.readlines()
for line in data:
word = line.split()
print word