#!/usr/bin/env python
# coding:UTF-8
"""
@version: python3.x
@author:曹新健
@contact: [email protected]
@software: PyCharm
@file: 下划线风格转驼峰风格.py
@time: 2018/12/29 22:01
"""
while True:
str = input("请输入一个下划线风格的字符串:")
if "_" in str:
"""
#方法二:
strlist = str.split("_")
Strlist = [s.capitalize() for s in strlist]
outStr = "".join(Strlist)
print(outStr)
"""
# 方法一:
print("".join(map(lambda x:x.capitalize(), str.split("_"))))
break
print("输入错误,请重新输入")
continue
Python:字符串下划线风格转驼峰风格
猜你喜欢
转载自blog.csdn.net/caoxinjian423/article/details/85370279
今日推荐
周排行