题目:
字符串 "axbyczdj",如果得到结果“abcd”
方法一:
''' 字符串 "axbyczdj",如果得到结果“abcd” ''' string1 = 'axbyczdj' new_list = [] string1_list = list(string1) for letter in string1_list: if letter in 'abcd': new_list.append(letter) print('新的字符串是:' + ''.join(new_list))
2024-04-06 23:53:20
题目:
字符串 "axbyczdj",如果得到结果“abcd”
方法一:
''' 字符串 "axbyczdj",如果得到结果“abcd” ''' string1 = 'axbyczdj' new_list = [] string1_list = list(string1) for letter in string1_list: if letter in 'abcd': new_list.append(letter) print('新的字符串是:' + ''.join(new_list))
下一篇:指针指向分析