https://www.python.org/dev/peps/pep-0008/
#!/usr/bin/python # -*- coding:utf-8 -*- # @filename: pep_summary # @author:wwx399777 wuweiji # @date: 2017/9/5 8:45 # Start at 5th Sep 2017 # Change at 6th Sep 2017 add Class and function summary import os import sys from subprocess import Popen, PIPE from selenium.webdriver.support.wait import WebDriverWait # long content cut to two or more part with "\" content = "this is a very long long long long long long long long long content long \ content" slice_content = content[2:10:2] print slice_content length_con = len(content) a, b, c = "", None, None if 72 < length_con <= 120: if content == "this" and length_con == 80: length_con = (length_con + length_con + length_con + length_con) print length_con # different between "is" and "==" if b is not c: print "different object" else: print "same object" if a == c: print "same value" else: print "different value" # different between "and" and "&" aa, bb, cc = 1, 2, 1 if aa == 1 and bb == 2: print "‘and‘ is logic operation, 1 treat as decimal 1" if aa == 1 & cc == 1: print "‘&‘ is bitwise operation, 1 treat as binary 01" else: print "different" try: aa == bb except Exception as e: print "aa is not equal to bb" # add whitespace at the lowest priorities i = aa + bb ii = (aa+bb) + aa*(bb+cc) + aa - bb # Don‘t use spaces around the "=" when used to indicate a keyword argument or a default parameter value def func(default_para1=1, para2=None): return func(1, None) def func(default_para1=1, para2=None): return func(1, None) class Class_(TypeError): def __init__(self, para1, ): self.para1 = para1 def class_func1(self, para_f1,): para_f1 = self.para1 return para_f1 def class_func1(self, para_f1, ): para_f1 = self.para1 # name suffix or prefix with double "__" single "_"
时间: 2024-10-23 10:11:50