Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit dc0ee70

Browse files
Update consolidated snippets
1 parent 9ad1903 commit dc0ee70

File tree

1 file changed

+0
-13
lines changed

1 file changed

+0
-13
lines changed

‎public/consolidated/python.json‎

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -114,19 +114,6 @@
114114
"contributors": [],
115115
"code": "class ExceptionName(BaseException):\n def __init__(message: str):\n super().__init__(message)\n\n# Usage\na: int = 1\n\nif a > 0:\n raise ExceptionName('Error Message')\n"
116116
},
117-
{
118-
"title": "Handle File Not Found Error",
119-
"description": "Attempts to open a file and handles the case where the file does not exist.",
120-
"author": "axorax",
121-
"tags": [
122-
"python",
123-
"error-handling",
124-
"file",
125-
"utility"
126-
],
127-
"contributors": [],
128-
"code": "def read_file_safe(filepath):\n try:\n with open(filepath, 'r') as file:\n return file.read()\n except FileNotFoundError:\n return \"File not found!\"\n\n# Usage:\nprint(read_file_safe('nonexistent.txt')) # Output: 'File not found!'\n"
129-
},
130117
{
131118
"title": "Retry Function Execution on Exception",
132119
"description": "Retries a function execution a specified number of times if it raises an exception.",

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /