摘要:
对多个变量设置相同的值时,用连等号一起赋值x = 10y = 10z = 10改成:x = y = z = 10交换变量值时,可以避免定义新的临时变量x = 10y = 5temp = xx = yy = temp改成:x = 10y = 5x, y = y, x多次调用字符对象方法时,可以用链式调用方法,避免中间产生过多变量 str1 = 'i am a bug!'str2 = str1.strip()str3 = str2.upper()str4 = str3.replace('!', '?')改成:str4 = str1.strip().u 阅读全文