use Python datetime module, strftime Write a program that processes the following textfile and prints the report...

90.2K

Verified Solution

Question

Programming

use Python datetime module, strftime

Write a program that processes the following textfile and printsthe report shown below.

Textfile:

  • Ask the user for the filename and BE SURE TO CHECK THAT ITEXISTS.
  • The file will contain lines which each contain 2 strings(bookTitle and publicationDate) separated by a comma and a space.Note that the title of the book might contain spaces!
  • Example of the textfile:

Gone Girl, 5-24-2012
To Kill A Mockingbird, 7-11-1960
Harry Potter and the Sorcerer’s Stone, 6-26-1997

Output: print the title and the publication date formatted intwo ways (using strftime)

Example output:

Title                                                    PublicationDate          Alternate Date

GoneGirl                                            May 24,2012               5/24/12
To Kill AMockingbird                           July 11,1960                7/11/60
Harry Potter and the Sorcerer’s Stone    June 26,1997              6/26/97

Answer & Explanation Solved by verified expert
4.5 Ratings (1135 Votes)
Please find below modified code anddont forget to give a LikePlease refer screenshot for indentation and outputModified code as per user requirementsfrom ospath importfrom datetime importdef main title pubdate alternatedate nameinputEnter file name    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students