Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import re
- sample_list = ['Xkn59438', 'yhdck2', 'eihd39d9', 'chdsye847', 'hedle3455', 'xjhd53e', '45da', 'de37dp']
- a_result = []
- b_result = []
- c_result = []
- def A(value):
- result = re.search(r'\w+5+\w', value)
- if result:
- a_result.append(result.group(0))
- def B(value):
- result = re.search(".*(d|e).*", value)
- if result:
- b_list.append(result.group(0))
- for value in sample_list:
- if A(value) and B(value):
- print("A condition: ", a_list)
- print("B condition: ", b_list)
Add Comment
Please, Sign In to add comment