A
A
Andrei Sayevich2020-06-24 20:58:40
Python
Andrei Sayevich, 2020-06-24 20:58:40

How to split list of logs in python?

From such a list

logi = [
    '2019-01-01,user0,3',
    '2019-01-07,user0,4',
    '2019-03-29,user0,1',
    '2019-04-04,user0,13',
    '2019-01-05,user1,7',
    '2019-06-14,user2,4',
    '2019-07-02,user2,10',
    '2019-03-21,user3,19',
    '2019-03-22,user3,4',
    '2019-04-22,user3,8',
    '2019-05-03,user3,9',
    '2019-05-11,user3,11',
]


in about this

logi = [
    ["2019-01-01","user0","3"],
    ["2019-01-07","user0","4"],
    ["2019-03-29","user0","1"],
    ["2019-04-04","user0","13"],
    ["2019-01-05","user1","7"],
    ["2019-06-14","user2","4"],
    ["2019-07-02","user2","10"],
    ["2019-03-21","user3","19"],
    ["2019-03-22","user3","4"],
    ["2019-04-22","user3","8"],
    ["2019-05-03","user3","9"],
    ["2019-05-11","user3","11"],
]

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
ScriptKiddo, 2020-06-24
@Soerrrrrrr

[x.split(',') for x in logi]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question