Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import re
- str1 = "Welcome to _CEICData. Welcome to BPA; Wecome to ISI"
- str1_list = re.split(r'[;,._ ]', str1)
- while "" in str1_list:
- str1_list.remove('')
- for x in str1_list:
- if len(x)>4:
- x_list = list(x)
- x_list[4:len(x)] = "."*(len(x)-4)
- x_list = ''.join(x_list)
- print(x_list,end=" , ")
- else:
- print(x,end=" , ")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement