• day13 练习


    day13 练习

    筛选掉长度小于3的,剩下的大写输出

    lst = ['吴彦祖','这一年','解决','就','可好看','就看见了','dfafdsa']

    ls = [name.upper() for name in lst if len(name)>=3 ]

    print(ls)

    #笛卡尔积

    lst = [(i,j)for i in range(5) for j in range(5) if i%2==0 and j%2==1]

    print(lst)

    #去除列表中的3,6,9,组成新的列表

    lst = [[1,2,3],[4,5,6],[7,8,9]]

    lst1 = [ls[2]for ls in lst]

    print(lst1)

    #[3,6,9]

    print([[i-2,i-1,i] for i in [3,6,9]])

    #50以内能被3整除的数的平方

    print([i**2 for i in range(50) if i%3==0])

    #[(0, 1), (1, 2), (2, 3), (3, 4), (4, 5), (5, 6)]

    print([(i,i+1) for i in range(6])

    #lst = ['sdf','发大水发多少','d地方大师傅']

    print( el+str(index) for index,el in enumerate(lst)

    print([lst[i]+str(i) for i in range(len(lst))])

    # [[1517991992.94, 100], [1517992000.94, 200], [1517992014.94, 300],

    # [1517992744.94, 350], [1517992800.94, 280]]

    x = {

      'name':'alex'

      'Values':[{'timestamp':1517991992.94,

      'values':100,},

      {'tmestamp': 1517992000.94,

      'values': 200,},

      {'timestamp': 1517992014.94,

      'values': 300,},

      {'timestamp': 1517992744.94,

      'values': 350},

      {'timestamp': 1517992800.94,

      'values': 280}],}

    print([[i['timestamp'],i['values']] for i in x['Values']])

  • 相关阅读:
    字符串
    Flume集群搭建
    hbase测试搭建
    hadoop2.0测试环境安装
    kafka集群报错
    kafka集群安装
    hadoop环境配置
    zookeeper安装
    虚拟机时间同步14 Aug 04:09:18 ntpdate[2941]: no server suitable for synchronization found
    python numpy中数组.min()
  • 原文地址:https://www.cnblogs.com/bilx/p/11333505.html
Copyright © 2020-2023  润新知