Run
def remove_first_line(x): # Given N new_line_index = x.find('\n') # Variable to hold resulting string x_without_first_line = '' if new_line_index > -1: # Remove first line x_without_first_line = x[new_line_index+1:] return x_without_first_line # Take a string x = "This is line 1.\nThis is line 2.\nThis is line 3." print(f"Given string\n\"{x}\"\n") print(f"Result string\n\"{remove_first_line(x)}\"")
Output