Only because no one else has mentioned it:
>>> 'bob'.title()
'Bob'
>>> 'sandy'.title()
'Sandy'
>>> '1bob'.title()
'1Bob'
>>> '1sandy'.title()
'1Sandy'
However, this would also give
>>> '1bob sandy'.title()
'1Bob Sandy'
>>> '1JoeBob'.title()
'1Joebob'
i.e. it doesn't just capitalize the first alphabetic character. But then .capitalize()
has the same issue, at least in that 'joe Bob'.capitalize() == 'Joe bob'
, so meh.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…