Split camel case string word by word in Python

Split camel case string word by word

import re
str = 'getSampleTextFromDB'
[x for x in re.split('([a-z]+)([A-Z][a-z]+)|([A-Z][a-z]+)', str) if x != None and x != '']

Execution result

['get', 'Sample', 'Text', 'From', 'DB']

Recommended Posts

Split camel case string word by word in Python
case class in python
String manipulation in python
Generate Word Cloud from case law data in python3
String object methods in Python
String date manipulation in Python
Sort by date in python
Split iterator into chunks in python
Create a random string in Python
Conversion of string <-> date (date, datetime) in Python
Read the file line by line in Python
Automate jobs by manipulating files in Python
Read the file line by line in Python
Module to generate word N-gram in Python
Python string
Generate a class from a string in Python
Common mock by moto in Python Unittest
Alignment algorithm by insertion method in Python
Scene recognition by GIST features in Python
String → Bool value conversion in Python Consideration
Divides the character string by the specified number of characters. In Ruby and Python.
Get the last element of the array by splitting the string in Python and PHP
How to embed a variable in a python string
Project Euler # 8 "Maximum Product in Number String" in Python
Automatically create word and excel reports in python
English word spell check tool (made by python)
Split files when writing vim plugin in python
Keep key names case in Python standard ConfigParser
Create a datetime object from a string in Python (Python 3.3)
json.dumping None in python returns the string null
Insert an object inside a string in Python
Split Python images and arrange them side by side
Quadtree in Python --2
Python in optimization
Python: String concatenation
Metaprogramming in Python
Python 3.3 in Anaconda
Geocoding in python
Python string format
SendKeys in Python
python string slice
Meta-analysis in Python
Unittest in python
Epoch in Python
Discord in Python
Sudoku in Python
nCr in python
N-Gram in Python
Programming in python
Plink in Python
Lifegame in Python.
FizzBuzz in Python
Sqlite in python
N-gram in python
LINE-Bot [0] in Python
Csv in python
Disassemble in Python
Python2 string type
Python string format
Constant in python
Python # string type