w3resource
Python Exercises

Python: Convert snake case string to camel case string

Python Regular Expression: Exercise-37 with Solution

Write a python program to convert snake case string to camel case string.

Sample Solution:-

Python Code:

def snake_to_camel(word):
        import re
        return ''.join(x.capitalize() or '_' for x in word.split('_'))

print(snake_to_camel('python_exercises'))

Sample Output:

PythonExercises

Flowchart:

Flowchart: Regular Expression - Convert snake case string to camel case string.

Visualize Python code execution:

The following tool visualize what the computer is doing step-by-step as it executes the said program:

Python Code Editor:

Have another way to solve this solution? Contribute your code (and comments) through Disqus.

Previous: Write a python program to convert camel case string to snake case string.
Next: Write a Python program to extract values between quotation marks of a string.

What is the difficulty level of this exercise?



New Content: Composer: Dependency manager for PHP, R Programming