Here is how to write the attribute as a string like column1,column2,column3
(using the C API since you seem to be using it despite asking for C++):
hid_t atype = H5Tcopy(H5T_C_S1);
H5Tset_size(atype, H5T_VARIABLE);
hid_t attr = H5Acreate(dset, "columns", atype, H5S_SCALAR, H5P_DEFAULT);
H5Awrite(attr, atype, "column1,column2,column3");
H5Aclose(attr);
Then to read it in Python:
import h5py
file = h5py.File("my_file.h5", "r")
dset = file["/my_dset"]
columns = dset.attrs["columns"].split(",")