随笔分类 - Python
摘要:def triangles(): prev_line = [1] while True: yield prev_line result = [1] if len(prev_line) == 1: result.append(1) if len(prev_line) > 1: for i in ran
阅读全文
摘要:import copy 假设在python中对list的复制 copy称为浅复制 deepcopy称为深复制 浅复制和深复制在一般的list中作用是相同的,都是进行一个复制 但是在list嵌套list中就会有区别 比如: a = [1,2,[3,4]] b = copy.copy(a) c= cop
阅读全文
摘要:# -*- coding: utf-8 -*-import string def extend_word(text): if text.find('\'') > 0: old2new = dict() words = text.split() for word in words: if word.f
阅读全文
浙公网安备 33010602011771号