#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ @Copyright (C) ansjer cop Video Technology Co.,Ltd.All rights reserved. @AUTHOR: ASJRD018 @NAME: Ansjer @software: PyCharm @DATE: 2018/6/14 14:46 @Version: python3.6 @MODIFY DECORD:ansjer dev @file: util_jk.py @Contact: chanjunkai@163.com """ '''---------------------------------------------------''' # 简化for语句 def getFor(): data = {'a': 1, 'b': 2, 'c': 3, 'd': 4} ss = [z for z in data if not data['a'] == 1] print(ss) '''---------------------------------------------------''' # lamdba def getLamdba(): b = lambda a,y: a + 1+y print(b(a=1,y=2)) '''-----------判断系统版本------------------------''' def UsePlatform(): import platform sysstr = platform.system() if (sysstr == "Windows"): print("Call Windows tasks") elif (sysstr == "Linux"): print("Call Linux tasks") else: print("Other System tasks")