@Slawek, I would split the opt_value string each time, instead of removing the "\n". That will take only the first part of the string, removing the tail.
>>> opt_value = "xxx\n128,aa:bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\n120,aa.cc\n128,:" >>> opt_value.split()[0] "xxx"
@Slawek, I would split the opt_value string each time, instead of removing the "\n". That will take only the first part of the string, removing the tail.
>>> opt_value = "xxx\n128, aa:bbbbbbbbbbbb bbbbbbbbbbbbbbb bbbbbbbbbbbbbbb bbbbbbbbbbbbbbb bbbbbbbbbbbbb\ n120,aa. cc\n128, :" split() [0]
>>> opt_value.
"xxx"