There is regex to separate all uppercase words but this "
import Do not work again S = 'Wd + C # SD *' Slow = ''. (Repeat. '([[AG]] [- #] *', S)) Print slow
/>When I checked that it works fine but in the program it only gives lowercase letters.
In the example given above, it should output
d +
,i #
, andd *
You
s = 'wd + c # sd *' import string print (s.translate (none, string.uppercase)) d + i # D *
a bit faster than a Regex and faster than joining:
in [29]: import again [30] : [=] In [4]: 'Time'. [33]: 'String' [33]: TimeIT S. Translicate (None, String.PaperCase). 1000000 loops, the best 3: 388 ns per loop in [38]: time '' 100,000 loops, best 3: 2.07 μs per loop
Comments
Post a Comment