str.strip() returns a string with leading+trailing whitespace removed, .lstrip and .rstrip for only leading and trailing respectively.
grades.append(lists[i].rstrip('\n').split(','))
str.strip() returns a string with leading+trailing whitespace removed, .lstrip and .rstrip for only leading and trailing respectively.
grades.append(lists[i].rstrip('\n').split(','))