Capitalize a string

前端 未结 9 824
轻奢々
轻奢々 2020-11-27 19:33

Does anyone know of a really simple way of capitalizing just the first letter of a string, regardless of the capitalization of the rest of the string?

For example:

9条回答
  •  旧时难觅i
    2020-11-27 19:52

    for capitalize first word;

    a="asimpletest"
    print a.capitalize()
    

    for make all the string uppercase use the following tip;

    print a.upper()
    

    this is the easy one i think.

提交回复
热议问题