【发布时间】:2015-09-22 05:08:20
【问题描述】:
这是源代码:
def revers_e(str_one,str_two):
for i in range(len(str_one)):
for j in range(len(str_two)):
if str_one[i] == str_two[j]:
str_one = (str_one - str_one[i]).split()
print(str_one)
else:
print('There is no relation')
if __name__ == '__main__':
str_one = input('Put your First String: ').split()
str_two = input('Put your Second String: ')
print(revers_e(str_one, str_two))
如何从第一个字符串中删除两个字符串中出现的字母然后打印它?
【问题讨论】:
-
''.join(letter for letter in str_one if letter not in str_two)
标签: string python-3.x slice