0

In this example is the ".txt" supposed to be referenced as the type of file, so we should replace it with with png, PDF, etc.?

21st Aug 2019, 11:50 PM
Zero-KohaiSenpai
Zero-KohaiSenpai - avatar
4 ответов
+ 2
Correct. However, you may need special methods to read files other than plaintext.
22nd Aug 2019, 2:07 AM
Rora
+ 1
We are not really sure which example you're talking about, since the Q&A does not link back to the lesson slides. Can you elaborate on your question? Is this about reading from text files?
22nd Aug 2019, 1:44 AM
Fermi
Fermi - avatar
+ 1
For example in open("filename.txt"), the .txt part is referring to the extension of a file correct?
22nd Aug 2019, 1:50 AM
Zero-KohaiSenpai
Zero-KohaiSenpai - avatar
0
Yep. You can't just open a pdf as plaintext. https://stackoverflow.com/questions/9951427
22nd Aug 2019, 4:04 AM
Fermi
Fermi - avatar