Skip to content

zoefunds/power-learn-python-week4-assignment

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 

Repository files navigation

power-learn-python-week4-assignment

  1. The program defines a process_file() function that handles the main logic.

  2. Error Handling:

    • FileNotFoundError: Handles cases where the input file doesn't exist
    • PermissionError: Handles cases where the program doesn't have permission to access the file
    • IOError: Handles general input/output errors
    • Exception: Catches any other unexpected errors
  3. File Operations:

    • Uses with statements for proper file handling (automatically closes files)
    • Reads content from the input file
    • Modifies the content (in this case, converts to uppercase)
    • Creates a new filename by adding 'modified_' prefix
    • Writes the modified content to the new file
  4. To use this program:

  • Save it as file_processor.py
  • Run it from the command line using python file_processor.py
  • When prompted, enter the name of a file you want to process
  • The program will create a new file with "modified_" prefix containing the uppercase version of the original content

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages