Empty Removal

    0

    0

    Mahendra Kumar

    beginnerlistDSA

    Python program to remove empty strings from a list

    # take list
    my_list = ['Know Program', '', 'Python', 'C', '', 'Java']
    # printing original list
    print('List:', my_list)
    # remove empty string using native method
    new_list = []
    for i in my_list:
        if (i):
            new_list.append(i)
    # printing list without empty string
    print('New List:', new_list)
    
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Playground
    • Snippets
    • Cookbooks
    Legal
    • Security
    • Privacy Policy
    • Code Privacy
    • Terms of Service
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.