I have the following list Novar
:
["'population_3000|road_class_3_3000'", "'population_3000|road_class_3_3000|trafBuf25'", "'population_3000|road_class_3_3000|trafBuf25|population_1000'"]
How can I append a character (e.g. $
) to a specific part of the items in the list, for instance to road_class_3_3000
, so that the upgraded list becomes:
["'population_3000|road_class_3_3000$'", "'population_3000|road_class_3_3000$|trafBuf25'", "'population_3000|road_class_3_3000$|trafBuf25|population_1000'"]
Most similar questions on Stack Overflow seem to focus on manipulating the item itself, rather than a part of the item, e.g. here and here.
Therefore, applying the following code:
if (item == "road_class_3_3000"):
item.append("$")
Would be of no use since road_class_3_3000
is part of the items "'population_3000|road_class_3_3000'"
, "'population_3000|road_class_3_3000|trafBuf25'"
and "'population_3000|road_class_3_3000|trafBuf25|population_1000'"