[Python] Python how to replace a None value in list with string None [duplicate]

Discussão em 'Python' iniciado por Stack, Abril 9, 2025.

  1. Stack

    Stack Membro Participativo

    I have list:

    test_list = ['one','two',None]


    Is there any simple way to replace None with 'None' ,without using index, because index for None maybe different each time.

    I tried :

    conv = lambda i : i or 'None'
    res = [conv(i) for i in test_list]


    It works ,is there another way to do so ?

    Continue reading...

Compartilhe esta Página