0

Is there a simple function I can use instead of re.sub or re.split? (Thank you)

import re camel_case_string = input("camleCase") result = re.sub(r'(?<=[a-z])(?=[A-Z])', "_", camel_case_string).lower() print(result)

17th Feb 2024, 7:40 PM
Oslein
Oslein - avatar
7 Respostas
+ 2
Oslein , If you want help, help the people who help, and supply as much information as possible. You forgot: Python You forgot: Code Coach Camel to Snake Never use this in any Code Coach: input("some prompt text") The prompt text gets printed. Only print the text that the requirements ask for. Yes, there are many other ways to solve that than re, such as looping through the input string to get each character and building an output string as you go, then printing the output string when your loop is done.
17th Feb 2024, 9:20 PM
Rain
Rain - avatar
+ 2
yes
18th Feb 2024, 3:14 AM
Bob_Li
Bob_Li - avatar
+ 1
tag the relevant programming language, not "hhhhhh"
17th Feb 2024, 8:08 PM
Lisa
Lisa - avatar
+ 1
str1 = input() for c in str1: print(c)
18th Feb 2024, 3:20 AM
Bob_Li
Bob_Li - avatar
+ 1
Thank you very much I never thought about that
18th Feb 2024, 3:21 AM
Oslein
Oslein - avatar
0
Thank you but is it possible to loop through letters
18th Feb 2024, 3:08 AM
Oslein
Oslein - avatar
0
Can you tell me for example give me a simple example om how I should assign a variable to the letters
18th Feb 2024, 3:16 AM
Oslein
Oslein - avatar