📜  如何在python代码示例中的大写字母前添加空格

📅  最后修改于: 2022-03-11 14:47:14.709000             🧑  作者: Mango

代码示例2
def cap_space(text):
  new_text = ' '

  for i, letter in enumerate(text):
    if i and letter.isupper():
      new text +=' '
      
    new_text = letter

print(cap_space("helloworld"))
print(cap_space("iLoveMyTeapot"))
print(cap_space("stayIndoors"))