string - Split when character changes in Python -


Then I have this string.

<6> / Code> so that I can replace 6 = M or 666 = O or 9 = W just like the phone's dial pad.

  6 # 666 # 665533999 -> 6, 666, 66, 55, 33, 999   

so I used to remove # split ('#') > And it does not understand what to do next. I have tried the methods of brute force which solves it to some extent, but is it easy or more elegant solution?

Use:

  & gt; & Gt; & Gt; C = "6 # 666 # 665533999"> gt; & Gt; & Gt; ("6", '666', '66', '55', '33', '999 '] ["".   

Then there is a dictionary which MAP for a character in the dial pad.

  cmap = {'77': 'Q' '9999': 'z') #and further ...    

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -