Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- raw_list = ['Apple FResh', 'Americano', 'animator Bob', 'tea$.sugar Menu', 'tea And Sugar', 'hello Tom And jeRRy',
- '6 Hours', 'banana']
- filtered = []
- def list_filter():
- is_end = False
- for string in raw_list:
- words = string.split(' ')
- print 'words', words
- for i, s in enumerate(words):
- if s.isdigit():
- is_end = True
- print 'is digit', s
- break
- if len(words) > 1 and not s[0].isupper():
- is_end = True
- break
- if i > 0:
- if s[0].isupper():
- continue
- else:
- is_end = True
- print 'not upper', s
- break
- if is_end:
- break
- else:
- filtered.append(string)
- list_filter()
- print filtered
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement