+ 2

Is the variable "text" of the type string ?

with open(filename) as f: text = f.read()

2nd Mar 2017, 7:24 AM
Marti
Marti - avatar
2 Answers
+ 4
https://docs.python.org/2/library/stdtypes.html#file-objects file.read([size]) The bytes are returned as a string object.
2nd Mar 2017, 8:30 AM
Álvaro
+ 1
yeah , string of file's text.
2nd Mar 2017, 7:58 AM
Aman Hanjra
Aman Hanjra - avatar