From PHP to Python In 10 Minutes

21 记录 Leave a Comment
PHP and Python are both high-level, interpreted programming languages with a variety of applications, but they have some significant differences in terms of syntax, design philosophy, and use cases. Here's a detailed comparison of the two languages: 1. Purpose and Use Cases PHP: Created by Rasmus Lerdorf in 199…

How to assert if Python enum contains specific string key or value

74 Uncategorized Leave a Comment
To assert if Python enum contains specific string key or value, we need helper function. class BaseEnum(Enum): @classmethod def has_name(cls, name): return name in cls._member_names_ @classmethod def has_value(cls, value): return value in cls._value2member_map_ class StatusEnum(str, BaseEnum): PUBLISHED = 1 PEN…

How to use Gmail to send email in Python

93 Uncategorized Leave a Comment
1 Add "App password" Go to Google account "Security", navigate to "Signing in to Google" and click "App passwords". Then select a type, here we use "Mail" and custom the device name. Type device name as "airflow", or you can choose any other name. Then…