File Handling and Exceptions

File Handling and Exceptions

✅ File Handling and Exceptions

  • Reading and writing files (open(), read(), write())
  • Exception handling (try-except)

Example:

try:
    number = int(input("Enter a number: "))
    print(number)
except ValueError:
    print("Invalid input!")