Python使用普通函数模拟生成器
摘要:
def flatten(nested): result = [] try: # 不迭代类似于字符串的对象 try: nested + '' except TypeError: pass else: raise TypeError for sublist in nested: for element 阅读全文
posted @ 2024-08-15 21:35 GoGrid 阅读(6) 评论(0) 推荐(0) 编辑