Why is there an unexpected character after line continuation character?

I get the unexpected character after line continuation character error after the first line of my code:

CSV3 = pd.DataFrame({"VS (kn)" : vsrangekn, "VS (m/s)" : vsrange, "Mean Open Water Eff." : etaOSmean, \
                     "Mean Behind Efficiency" : etaBSmean, "Mean Hull Eff." : hulleffmean, \
                     "Mean Quasi-Propulsive Eff." : etaDSmean, "Maximum Open Water Eff." : etaOSmax, \
                     "Maximum Behind Eff." : etaBSmax, "Maximum Hull Eff." : hulleffmax, \
                     "Maximum Quasi-Propulsive Eff." : etaDSmax, "Minimum Open Water Eff." : etaOSmin, \
                     "Minimum Behind Eff." : etaBSmin, "Minimum Hull Eff." : hulleffmin, \
                     "Minimum Quasi-Propulsive Eff." : etaDSmin})
CSV3.insert(7, '', empty_array)
CSV3.insert(13, '', empty_array)
CSV3.to_csv("SD3mean.csv", index=False)

I don’t have a space after the backslashes and the format works fine in the other places I use it. Does anyone have an idea of what the problem is?

Just remove those backslashes: they are not needed here. Both ( and { automatically allow continuation lines.

Thanks. I managed to fix it by discovering the strip trailing whitespace button in the format tab. I don’t know where the space was, but it worked after that.

It’s good you were able to solve it, but the unneeded line continuation characters are a bit of an eyesore.

That issue of invisible whitespace is why I avoid use of \ line continuation.

It is almost always avoidable, the simplest fix is to use () around a multi-line expression. As a trivial example:

x = (a *