摘要: Python map() 函数 Python 内置函数 描述 map() 会根据提供的函数对指定序列做映射。 第一个参数 function 以参数序列中的每一个元素调用 function 函数,返回包含每次 function 函数返回值的新列表。 语法 map() 函数语法: map(functio 阅读全文
posted @ 2020-06-21 15:26 Fmaj-7 阅读(172) 评论(0) 推荐(0)
摘要: import random def yield_test(n): for i in range(n): yield call(i) print("i=",i) #做一些其它的事情 print("do something.") print("end.") def call(i): return i*2 阅读全文
posted @ 2020-06-21 11:19 Fmaj-7 阅读(193) 评论(0) 推荐(0)
摘要: def get_commands(): """ Returns a dictionary mapping command names to their callback applications. This works by looking for a management.commands pac 阅读全文
posted @ 2020-06-20 18:08 Fmaj-7 阅读(208) 评论(0) 推荐(0)
摘要: def __setattr__(self, name, value): """ Set the value of setting. Clear all cached values if _wrapped changes (@override_settings does this) or clear 阅读全文
posted @ 2020-06-20 09:54 Fmaj-7 阅读(893) 评论(0) 推荐(0)
摘要: counts = Counter( app_config.name for app_config in self.app_configs.values()) Counter({'django_celery_beat': 1, 'django.contrib.sessions': 1, 'corshe 阅读全文
posted @ 2020-06-19 16:26 Fmaj-7 阅读(139) 评论(0) 推荐(0)
摘要: Python issubclass() 函数 Python 内置函数 描述 issubclass() 方法用于判断参数 class 是否是类型参数 classinfo 的子类。 语法 以下是 issubclass() 方法的语法: issubclass(class, classinfo) 参数 cl 阅读全文
posted @ 2020-06-19 14:26 Fmaj-7 阅读(148) 评论(0) 推荐(0)
摘要: Python rpartition() 方法 Python 字符串 描述 rpartition() 方法类似于 partition() 方法,只是该方法是从目标字符串的末尾也就是右边开始搜索分割符。。 如果字符串包含指定的分隔符,则返回一个3元的元组,第一个为分隔符左边的子串,第二个为分隔符本身,第 阅读全文
posted @ 2020-06-19 14:21 Fmaj-7 阅读(292) 评论(0) 推荐(0)
摘要: 当唔异常时,else方法也执行 try: # If import_module succeeds, entry is a path to an app module, # which may specify an app config class with default_app_config. # 阅读全文
posted @ 2020-06-19 14:16 Fmaj-7 阅读(425) 评论(0) 推荐(0)
摘要: FBV FBV(function base views) 就是在视图里使用函数处理请求。 CBV CBV(class base views) 就是在视图里使用类处理请求。 Python是一个面向对象的编程语言,如果只用函数来开发,有很多面向对象的优点就错失了(继承、封装、多态)。所以Django在后 阅读全文
posted @ 2020-06-18 09:32 Fmaj-7 阅读(550) 评论(0) 推荐(0)
摘要: class Field(object): widget = TextInput # Default widget to use when rendering this type of Field. hidden_widget = HiddenInput # Default widget to use 阅读全文
posted @ 2020-06-17 09:44 Fmaj-7 阅读(187) 评论(0) 推荐(0)