Q:

Converting uppercase to lowercase with hyphen

I'm processing some CSS code using Python, since they came from a JSON file (JSON doesn't accept hyphens) they have a particular notation eg.. font-size = fontSize, I'd like to convert every uppercases letter and put them back in the right CSS format inserting a hyphen right before the uppercase.
string = 'borderRadius: 0px, zIndex: 2, transform: translate(170px, 195px) skew(-30deg, 0deg), fontSize:30px'

def getIndices(string):
    // get position of each capital letters.
    index = [i for i, c in enumerate(string) if c.isupper()] 

    // code below would be inserted here.

    // insert hyphen right before the upperscase
    for i in index:
        string = string[:i] + '-' + string[i:]

    // once done, set string to lowercase since there are no uppercases in CSS properties
    string = string.lower()
    return string

getIndices(string)

The issue is that each time a hyphen is insered, the position of capital letters becomes off hence the insertion are off too.
I thought about enumarting the index and increasing each int in list by their index number, but I'm probably doing something not quite right.
...
index = [25, 35, 58]
for i, value in enumerate(index):
    value = value + (i)
    index[i] = value

Any suggestion would be helpful!

A:

If I got it right, this is one way of doing it
 for c in my_string:
      print c
      if c.isupper():
          my_string = my_string.replace(c,"-%s" % c.lower())

 print my_string # will print fontSize = font-size

