Computers and Technology, 16.02.2021 03:00 Ashtree519
Add a command to this chapter’s case study program that allows the user to view the contents of a file in the current working directory. When the command is selected, the program should display a list of filenames and a prompt for the name of the file to be viewed.
Be sure to include error recovery in the program. If the user enters a filename that does not exist they should be prompted to enter a filename that does exist.
An example of the program input and output is shown below:
/root/sandbox
1 List the current directory
2 Move up
3 Move down
4 Number of files in the directory
5 Size of the directory in bytes
6 Search for a file name
7 View the contents of a file
8 Quit the program
Enter a number: 7
Files in /root/sandbox:
filesys. py
example. txt
Enter a file name from these names: example. txt
THIS IS CONTENT OF AN EXAMPLE FILE.
/root/sandbox
1 List the current directory
2 Move up
3 Move down
4 Number of files in the directory
5 Size of the directory in bytes
6 Search for a file name
7 View the contents of a file
8 Quit the program
Enter a number: 8
Have a nice day!
Answers: 3
Computers and Technology, 22.06.2019 20:00, bowmanari2154
What is used to analyze and summarize your data without graphical support
Answers: 1
Add a command to this chapter’s case study program that allows the user to view the contents of a fi...
Mathematics, 22.08.2020 23:01
English, 22.08.2020 23:01
History, 22.08.2020 23:01
Mathematics, 22.08.2020 23:01