If you want to read a file called “logs.txt”, which line of code allows you to open this file for purposes of reading it and store it in a variable called file?

Automate Cybersecurity Tasks with Python | Weekly challenge 4 Quiz | 

If you want to read a file called “logs.txt”, which line of code allows you to open this file for purposes of reading it and store it in a variable called file?

  • with open(“logs.txt”, file, “r”):
  • with file.open(“logs.txt”, “r”):
  • with open(“logs.txt”, “r”) as file:
  • with open(“logs.txt”) as file:

 

Leave a Comment