Skip to content
No description, website, or topics provided.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Pyladies Intro to Python

Think Python Chp 14 Files

Exercise to create a log file

Create a python program

  1. Create a python program that will create a new file. This program should contain a single function that accepts a file name as a parameter and creates a new file with that name.

Create a second python program that will log

  1. Create a python module called
  2. Create a function that performs the following actions: a) Accepts a single argument that is a string b) Creates a file to write to c) Gets the current date/time d) Creates a string that contains the current date/time and also the message argument e) Writes that string from the previous step to the file create in step b.

Modify your first python program to start logging

  1. In your first python program, import your logging module
  2. Instantiate the function from that file in any place in the program you want to log a message
You can’t perform that action at this time.