BOOKPYTHON Telegram 3684
Если вы хотите перехватить и IndexError, и KeyError, вы можете и должны использовать LookupError — их общего предка. Это оказывается полезным при работе со сложными вложенными данными:


try:
db_host = config['databases'][0]['hosts'][0]
except LookupError:
db_host = 'localhost'


👉@BookPython
👍51



tgoop.com/BookPython/3684
Create:
Last Update:

Если вы хотите перехватить и IndexError, и KeyError, вы можете и должны использовать LookupError — их общего предка. Это оказывается полезным при работе со сложными вложенными данными:


try:
db_host = config['databases'][0]['hosts'][0]
except LookupError:
db_host = 'localhost'


👉@BookPython

BY Библиотека Python разработчика | Книги по питону


Share with your friend now:
tgoop.com/BookPython/3684

View MORE
Open in Telegram


Telegram News

Date: |

fire bomb molotov November 18 Dylan Hollingsworth yau ma tei Find your optimal posting schedule and stick to it. The peak posting times include 8 am, 6 pm, and 8 pm on social media. Try to publish serious stuff in the morning and leave less demanding content later in the day. Don’t publish new content at nighttime. Since not all users disable notifications for the night, you risk inadvertently disturbing them. Select: Settings – Manage Channel – Administrators – Add administrator. From your list of subscribers, select the correct user. A new window will appear on the screen. Check the rights you’re willing to give to your administrator. Write your hashtags in the language of your target audience.
from us


Telegram Библиотека Python разработчика | Книги по питону
FROM American