tal

python对mysql每个表备份

江枫思渺然 提交于 2019-12-24 14:52:10
import osimport pymysql as MySQLdbdef get_tb(sql): conn = MySQLdb.connect(host="127.0.0.1",user="root",password="123",db="ccdb",charset='utf8') cursor=conn.cursor() cursor.execute(sql) tables=[] for i in cursor.fetchall(): tables.append(i[0]) cursor.close() return tablesdef baksqltab(tal): password = "123" ldn='ccdb' for tab in tal: os.system("E:\\software\mysql-5.6.39-winx64\\mysql-5.6.39-winx64\\bin\\mysqldump.exe -uroot -p{} {} {} > E:\\{}.sql".format(password,ldn,tab,tab))if __name__ == '__main__': sql="select table_name from information_schema.tables where table_schema='ccdb' and table

tal nested dictionary syntax

。_饼干妹妹 提交于 2019-12-11 08:30:35
问题 Working with Pyramid, my code looks like this: class PageData: @staticmethod def create_data(): return [ { 'key_1A': 'info1A', 'key_2A': 'info2A', 'nested_list_A': [ {'nested_key1A': 'nested_val1A'}, {'nested_key2A': 'nested_val2A'}, ], }, { 'key_1A': 'info1B', 'key_2A': 'info2B', 'nested_list_B': [ {'nested_key1B': 'nested_val1B'}, {'nested_key2A': 'nested_val2A'}, ], }, ] And my html page code looks like this: <span tal:condition="nested_key1A"> Open </span> <span tal:condition="not nested

拼多多笔试

﹥>﹥吖頭↗ 提交于 2019-11-26 14:33:07
def decrease(A, B): for i, v in enumerate(A): if i == 0: pre = True next = True if A[i + 1] - v > 0 else False elif i == len(A)-1: pre = True if v - A[i - 1] > 0 else False next = True else: pre = True if v - A[i-1]>0 else False next = True if A[i+1]-v>0 else False if pre and next == False: tal = i break else: tal = None if tal == None: return "NO" else: num=[] for j,v in enumerate(B): if tal == 0: if v<A[tal+1]: num.append(v) elif tal == len(A)-1: if v>A[tal-1]: num.append(v) else: if v>A[tal-1] and v<A[tal+1]: num.append(v) A[tal] = max(num) return A print(decrease([9,1,2,3,4,5,6],[1,2,0,5,