fork download
  1. # 1. 创建字符串变量
  2. username = "xiaoming"
  3.  
  4. # 2. 转换为大写 upper() 是字符串转大写的方法
  5. upper_username = username.upper()
  6. print("大写形式:", upper_username)
  7.  
  8. # 3. 获取变量长度 len() 是计算长度的函数
  9. username_len = len(username)
  10. print("字符长度:", username_len)
Success #stdin #stdout 0.07s 14100KB
stdin
Standard input is empty
stdout
大写形式: XIAOMING
字符长度: 8