Jul-10-2022, 12:09 AM
def remove_lines_list (file): ip_list = open(file).readlines() return [address.rstrip('\n') for address in ip_list]I use this function to take a list of IP addresses and remove all the trailing \n so i get a clean list with no extra spaces or lines.. i dont know if this is helpful but i use this when getting a txt file in put of IP addresses i need to loop through.