Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Jupyter Notebook
- Untitled3-Copy1 Last Checkpoint: минуту назад (autosaved) Current Kernel Logo
- Python 3
- File
- Edit
- View
- Insert
- Cell
- Kernel
- Widgets
- Help
- from skimage.io import imread, imshow,imsave
- img = imread("d:\image.jpg")
- img.shape
- (416, 625, 3)
- imshow(img)
- C:\Users\Student\Anaconda3\lib\site-packages\skimage\io\_plugins\matplotlib_plugin.py:51: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.
- out_of_range_float = (np.issubdtype(image.dtype, np.float) and
- <matplotlib.image.AxesImage at 0x175a05d8668>
- for x in range(350):
- for y in range(450):
- img[x,y]=[255,255,255]
- import random
- key = [random.randint(0,255) for i in range(100)]
- for i in range(len(img)):
- img[i]=img[i]- key[i % len(key)]
- i= imshow(img)
- C:\Users\Student\Anaconda3\lib\site-packages\skimage\io\_plugins\matplotlib_plugin.py:51: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.
- out_of_range_float = (np.issubdtype(image.dtype, np.float) and
- #для всего цикла подставляем кеу, как меряем коробком мост
- for i in range(len(img)):
- img[i]=img[i]+ key[i % len(key)]
- i= imshow(img)
- C:\Users\Student\Anaconda3\lib\site-packages\skimage\io\_plugins\matplotlib_plugin.py:51: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.
- out_of_range_float = (np.issubdtype(image.dtype, np.float) and
- import threading
- import time
-
- def worker(number):
- sleep_time = 1 #randon.randint(1,5)
- time.sleep(sleep_time)
- print(sleep_time,'--',number)
- worker(1)
- 1 -- 1
-
-
- threads =[]
- for i in range(5):
- t = threading.Thread(target = worker, args=(i,))
- threads.append(t)
- t.start()
- 1 --1 -- 1
- 4
- 11 -- 2
- -- 3
- 1 -- 0
- name=['ivan','petr','Igraaaagim']
- for i in name:
- print('my name is',i)
- my name is ivan
- my name is petr
- my name is Igraaaagim
- import os
- #[-1] обращение к последнему элементу вне зависимости от длинны
- [i for i in os.listdir() if i.split('.')[-1]== 'jpg']
- ['cat.jpg',
- 'img.jpg',
- 'img1111111.jpg',
- 'kinogoim0.jpg',
- 'kinogoim1.jpg',
- 'kinogoim10.jpg',
- 'kinogoim11.jpg',
- 'kinogoim12.jpg',
- 'kinogoim13.jpg',
- 'kinogoim14.jpg',
- 'kinogoim15.jpg',
- 'kinogoim16.jpg',
- 'kinogoim17.jpg',
- 'kinogoim18.jpg',
- 'kinogoim19.jpg',
- 'kinogoim2.jpg',
- 'kinogoim20.jpg',
- 'kinogoim21.jpg',
- 'kinogoim3.jpg',
- 'kinogoim4.jpg',
- 'kinogoim5.jpg',
- 'kinogoim6.jpg',
- 'kinogoim7.jpg',
- 'kinogoim8.jpg',
- 'kinogoim9.jpg']
- #поиск всех папок
- [i for i in os.listdir() if i.split('.')[-1]== i]
- ['3D Objects',
- 'Anaconda3',
- 'AppData',
- 'Application Data',
- 'cat_jump_l',
- 'cat_jump_r',
- 'cat_run_l',
- 'cat_run_r',
- 'cat_stay_l',
- 'cat_stay_r',
- 'Contacts',
- 'Cookies',
- 'Desktop',
- 'Documents',
- 'Downloads',
- 'eclipse',
- 'eclipse-workspace',
- 'Favorites',
- 'IntelGraphicsProfiles',
- 'Links',
- 'Local Settings',
- 'Music',
- 'NetHood',
- 'OneDrive',
- 'Pictures',
- 'PrintHood',
- 'PycharmProjects',
- 'Recent',
- 'Saved Games',
- 'Searches',
- 'SendTo',
- 'Videos',
- 'главное меню',
- 'Мои документы',
- 'Шаблоны']
- #дз функция, рекурсивно обходящая дерево файлов
- a=[112.txt]
- File "<ipython-input-32-5958a1a15e18>", line 1
- a=[112.txt]
- ^
- SyntaxError: invalid syntax
- #работа с email
- import smtplib
- from email.mime.text import MIMEText
-
- msg = MIMEText("just text") #содержание сообщения
- msg['Subject'] = 'The contents of %s' % "just text"#название сообщения
- msg['From'] = "bkozlovsky@bk.ru"
- msg['To'] = "bkozlovsky@bk.ru"
- s = smtplib.SMTP('smtp.gmail.com',587)
- s.starttls()
- s.login("bkozlovsky@bk.ru", "gd0d469s")
- s.sendmail("bkozlovsky@bk.ru", ["bkozlovsky@bk.ru"], msg.as_string())
- s.quit()
- ---------------------------------------------------------------------------
- SMTPAuthenticationError Traceback (most recent call last)
- <ipython-input-38-86e0c0d72e09> in <module>()
- 9 s = smtplib.SMTP('smtp.mail.ru',587)
- 10 s.starttls()
- ---> 11 s.login("bkozlovsky@bk.ru", "gd0d469s")
- 12 s.sendmail("bkozlovsky@bk.ru", ["bkozlovsky@bk.ru"], msg.as_string())
- 13 s.quit()
- ~\Anaconda3\lib\smtplib.py in login(self, user, password, initial_response_ok)
- 728
- 729 # We could not login successfully. Return result of last attempt.
- --> 730 raise last_exception
- 731
- 732 def starttls(self, keyfile=None, certfile=None, context=None):
- ~\Anaconda3\lib\smtplib.py in login(self, user, password, initial_response_ok)
- 719 (code, resp) = self.auth(
- 720 authmethod, getattr(self, method_name),
- --> 721 initial_response_ok=initial_response_ok)
- 722 # 235 == 'Authentication successful'
- 723 # 503 == 'Error: already authenticated'
- ~\Anaconda3\lib\smtplib.py in auth(self, mechanism, authobject, initial_response_ok)
- 640 if code in (235, 503):
- 641 return (code, resp)
- --> 642 raise SMTPAuthenticationError(code, resp)
- 643
- 644 def auth_cram_md5(self, challenge=None):
- SMTPAuthenticationError: (435, b'Unable to authenticate at present:')
- text1 ="""#работа с email
- import smtplib
- from email.mime.text import MIMEText
-
- msg = MIMEText("just text") #содержание сообщения
- msg['Subject'] = 'The contents of %s' % "just text"#название сообщения
- msg['From'] = "bkozlovsky@bk.ru"
- msg['To'] = "bkozlovsky@bk.ru"
- s = smtplib.SMTP('smtp.gmail.com',587)
- s.starttls()
- s.login("bkozlovsky@bk.ru", "gd0d469s")
- s.sendmail("bkozlovsky@bk.ru", ["bkozlovsky@bk.ru"], msg.as_string())
- s.quit()"""
- # получение писем
-
-
- import imaplib
- msrvr = imaplib.IMAP4_SSL('imap.mail.ru',993)
- msrvr.login("bkozlovsky@bk.ru", "gd0d469ss")
- msrvr.select("inbox")
- stat, cnt = msrvr.search(None, "ALL")
- stat, data = msrvr.fetch(cnt[0].split()[-1],"(RFC822)")
- msrvr.close()
- msrvr.logout()
-
-
- ('BYE', [b'logging out'])
- import email
- mail = email.message_from_bytes(data[0][1], \
- _class = email.message.EmailMessage)
- print(mail.get_payload(None, True).decode("utf-8"))
- import smtplib
- from email.mime.text import MIMEText
- msg = MIMEText("just text") #содержание сообщения
- msg['Subject'] = 'The contents of %s' % "just text"#название сообщения
- msg['From'] = "bkozlovsky@bk.ru"
- msg['To'] = "bkozlovsky@bk.ru"
- s = smtplib.SMTP('smtp.mail.ru', 587)
- s.starttls()
- s.login("bkozlovsky@bk.ru", "gd0d469s")
- s.sendmail("bkozlovsky@bk.ru", ["bkozlovsky@bk.ru"], msg.as_string())
- s.quit()
- for i in range(113):
- print('start{}',i)
- start{} 0
- start{} 1
- start{} 2
- start{} 3
- start{} 4
- start{} 5
- start{} 6
- start{} 7
- start{} 8
- start{} 9
- start{} 10
- start{} 11
- start{} 12
- start{} 13
- start{} 14
- start{} 15
- start{} 16
- start{} 17
- start{} 18
- start{} 19
- start{} 20
- start{} 21
- start{} 22
- start{} 23
- start{} 24
- start{} 25
- start{} 26
- start{} 27
- start{} 28
- start{} 29
- start{} 30
- start{} 31
- start{} 32
- start{} 33
- start{} 34
- start{} 35
- start{} 36
- start{} 37
- start{} 38
- start{} 39
- start{} 40
- start{} 41
- start{} 42
- start{} 43
- start{} 44
- start{} 45
- start{} 46
- start{} 47
- start{} 48
- start{} 49
- start{} 50
- start{} 51
- start{} 52
- start{} 53
- start{} 54
- start{} 55
- start{} 56
- start{} 57
- start{} 58
- start{} 59
- start{} 60
- start{} 61
- start{} 62
- start{} 63
- start{} 64
- start{} 65
- start{} 66
- start{} 67
- start{} 68
- start{} 69
- start{} 70
- start{} 71
- start{} 72
- start{} 73
- start{} 74
- start{} 75
- start{} 76
- start{} 77
- start{} 78
- start{} 79
- start{} 80
- start{} 81
- start{} 82
- start{} 83
- start{} 84
- start{} 85
- start{} 86
- start{} 87
- start{} 88
- start{} 89
- start{} 90
- start{} 91
- start{} 92
- start{} 93
- start{} 94
- start{} 95
- start{} 96
- start{} 97
- start{} 98
- start{} 99
- start{} 100
- start{} 101
- start{} 102
- start{} 103
- start{} 104
- start{} 105
- start{} 106
- start{} 107
- start{} 108
- start{} 109
- start{} 110
- start{} 111
- start{} 112
- ДЗ
- 1первое-обработчик сообщений
- 2 парсит почту, найдя письмо, запускает аудио ттс
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement