Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #1
- class Test:
- def __init__(self, dict):
- for key in dict:
- setattr(self, key, dict[key])
- dict = {
- 'a': 'Утка утка',
- 'b': 'Утка утка',
- 'c': 'Утка утка',
- }
- obj = Test(dict)
- #2
- text = '''But soft what light through yonder window breaks
- It is the east and Juliet is the sun
- Arise fair sun and kill the envious moon
- Who is already sick and pale with grief'''
- words = {}
- for w in text.replace('\n', ' ').split(' '):
- try:
- words[w] = words[w] + 1
- except:
- words[w] = 1
- print(words)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement