Get the App
SLTechnology News&Howtos  ›  Development  › 

How to use camel function in python

Shulou Source: shulou.com Published: 2022-06-03 15:16:01 10月04日 Update

This article mainly shows you "how to use the camel function in python", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "how to use the camel function in python" this article.

1. Camel takes a variable name in the form of a string and converts it to a hump.

2. This function considers strings in the form of variables, and there are related separations between words, rather than directly consecutive words.

Like somefunctionname.

Example

From re import sub def camel (s): s = sub (r "(_ | -) +", ", s). Title (). Replace (" ") return s [0] .lower () + s [1:] # EXAMPLEScamel ('some_database_field_name') #' someDatabaseFieldName'camel ('Some label that needs to be camelized') #' someLabelThatNeedsToBeCamelized'camel ('some-javascript-property') #' someJavascriptProperty'camel ('some-mixed_string with spaces_underscores-and-hyphens') #' someMixedStringWithSpacesUnderscoresAndHyphens' is all the content of the article" how to use camel functions in python " Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Tags: Functions content form articles words variables characters strings learning help between examples easy to understand more organization knowledge editing industry information information channels Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei Microsoft Xiaomi OPPO Reno vpn