Menu

[Solved] Write a python script that: Prompts the user for the name of the directory in which they want to save a file

Write a python script that: Prompts the user for the name of the directory in which they want to save a file, Prompts the user for the name of the file they want to save to the directory in requirement 1, If the directory from requirement 1 doesn’t exist the program must create the specified directory, The program will prompt the user for their name, address, and phone number and write that data as a line of comma-separated values to the file using the directory and filename from requirements 1 and 2. (example: John Smith, 123 Main St,402-555-1212, and After the data has been written to the file your program must open the file, read the contents, and display the contents to the user as program output.

Expert Answer


import os filePath = input(‘Enter file path: ‘) fileName = input(‘Enter file name: ‘) if not os.path.exists(filePath): os.makedirs(filePath) complete…..

answer image blur

 

OR


Leave a Reply

Your email address will not be published. Required fields are marked *