it is written than readlines is a function still it is used with dot(.)operator like a method. why? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

it is written than readlines is a function still it is used with dot(.)operator like a method. why?

15th Jul 2016, 8:14 AM
Noorain Khurshid
Noorain Khurshid - avatar
2 Answers
+ 2
Method is function of class.
15th Jul 2016, 8:20 AM
vetarikisa
+ 2
ok @Khurshid dot operator is used to access a method under a class, now readline is a method like read() close() write() defined only under file class. so an object of file class can access these methods.
15th Jul 2016, 1:42 PM
Subhankar Paul
Subhankar Paul - avatar