enumerate() returns a tuple containing two items. First is an index (starting with 0) and second is an item from the iterable you enumerated.
You could instead unpack the tuple into two variables like this:
You could also access only the second element of the tuple - the string you want to split:
for line in enumerate(yrs_file):Here line is a tuple (index, item), so you can't use split on it, which is a method of string type.
You could instead unpack the tuple into two variables like this:
for index, line in enumerate(yrs_file):Then line will be a string which you can split.
You could also access only the second element of the tuple - the string you want to split:
for line in enumerate(yrs_file): (pdate,catg,amt,howp) = line[1].split(',')But in any case, I don't really see why you would need enumerate() in your code at all.