[Python] Python print first row of list

Discussão em 'Python' iniciado por Stack, Setembro 13, 2025.

  1. Stack

    Stack Membro Participativo

    I'm sure there a simple solution to this question but so far it has eluded me.

    I simply want to print out the first row the below list where [0] is the None value and [1] is the time stamp. Where ss is the list name.

    None 2018-05-21 00:15:23.154428
    None 2018-05-21 00:15:25.154428
    None 2018-05-21 00:28:49.154627
    None 2018-05-21 00:30:21.154642
    None 2018-05-21 00:30:23.154642
    None 2018-05-21 00:43:17.154838
    None 2018-05-21 00:43:19.154838
    None 2018-05-21 00:45:19.154857
    None 2018-05-21 00:45:21.154857
    None 2018-05-21 00:45:23.154858
    None 2018-05-21 01:43:17.155843
    None 2018-05-21 01:43:19.155843
    None 2018-05-21 01:43:21.155843
    None 2018-05-21 02:28:17.156551
    None 2018-05-21 02:28:19.156552
    None 2018-05-21 02:28:21.156552
    None 2018-05-21 02:28:23.156553
    None 2018-05-21 02:28:25.156553
    None 2018-05-21 02:28:27.156553
    None 2018-05-21 02:30:17.156571
    None 2018-05-21 02:30:19.156571
    None 2018-05-21 02:30:21.156571
    None 2018-05-21 02:58:17.157040
    None 2018-05-21 03:13:17.157249
    None 2018-05-21 03:43:17.157726
    None 2018-05-21 03:58:21.157929
    None 2018-05-21 03:58:23.157930
    None 2018-05-21 04:00:17.158008
    None 2018-05-21 04:00:19.158009
    None 2018-05-21 04:00:21.158009
    None 2018-05-21 04:58:17.158840
    None 2018-05-21 04:58:19.158841
    None 2018-05-21 05:13:17.159086
    None 2018-05-21 05:13:19.159086


    Here are several things I've attempted.

    #print ss[:2]

    #print next(ss)

    #for item in ss[0:1]:
    # print item

    #for i in ss :
    # print(i[0])
    #print(ss(zip(*0))[0])

    #print ss [0:1]

    #for row[0] for row in ss:
    print row

    Continue reading...

Compartilhe esta Página