Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

What does this period change in the line of code?

What does this period change in the command line? I defined "list" as a variable, but why can’t I just use the "write" command?
[1]: https://i.stack.imgur.com/JpRPz.png

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

First, don’t name variables using python built-ins such as list.

Secondly, to answer your question, assigning a file pointer to the variable list creates an object (to put it vaguely) list. In python, methods can perform functions specific to an object type, such as the one assigned to list. In your case, the method is to write the contents supplied to write() to the file you opened. Methods are called upon using . following an instantiated object.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading