[Solved] How to write the names that start with A – L to one file and the rest to another?


Check the alphabet-index of the first letter in the string:

    import string
    ind = string.lowercase.index(surname[0].lower())
    if ind <= 12: # A-L
        # Write to A-L file
    else:
        # Write to other file

7

solved How to write the names that start with A – L to one file and the rest to another?