There is a function to capitalize a string, I would like to be able to change the first character of a string to be sure it will be lowercase.
How can I do that in Python?
One-liner which handles empty strings and None:
None
func = lambda s: s[:1].lower() + s[1:] if s else '' >>> func(None) >>> '' >>> func('') >>> '' >>> func('MARTINEAU') >>> 'mARTINEAU'
2.1m questions
2.1m answers
60 comments
56.9k users