Remove First and Last Character
Instructions
It's pretty straightforward. Your goal is to create a function that removes the first and last characters of a string. You're given one parameter, the original string. You don't have to worry with strings with less than two characters.
Solution
def remove_char(s):
return s[1 : -1]
a_string[start : end] : 返回一个字符串类型,返回的数据是原字符串第2个字符到倒数第2个字符之间所有字符组成的字符串
人生便是艺术。

浙公网安备 33010602011771号