-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
71 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
x =[1,2,3,4,5,6,7,8] | ||
y = [1,2,3,4,5] | ||
z= x+y | ||
print(z) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import imapclient # use pip install imapclient <- easy for reading different email Server | ||
import pyzmail # easy to read different part of EMail like subject / body /cc/bcc/to/from etc | ||
from collections import Counter | ||
|
||
d=[] | ||
imapObj = imapclient.IMAPClient('imap.gmail.com', ssl=True) # email server for Gmail | ||
username=input("Enter your completer gmail User Name ") | ||
Password=input("Enter your gmail passowrd") | ||
imapObj.login(username,Password) # login Method for your email | ||
print("Dear", username," you are logged into your account") | ||
imapObj.select_folder('[Gmail]/Spam', readonly=True) # selecting different folder for phising email i used Spam | ||
UIDs = imapObj.search(['ALL']) # different filter for mailboxes ALL/SEEN/UNSEEN it returns ids for the filter you have search | ||
print( "No of emails in your [Gmail]/Spam' box=" ,len(UIDs)) | ||
print("Mail from\t\t"," Subject Line") | ||
for i in UIDs: # only 10 emails to be taken | ||
rawMessages = imapObj.fetch([i], ['BODY[]', 'FLAGS']) # fetch the email message for particular UID | ||
message = pyzmail.PyzMessage.factory(rawMessages[i][b'BODY[]']) # Parse the raw email message. | ||
print(message.get_addresses('from'),message.get_subject()) # return the subject part of email | ||
message.text_part != None # check for text part of body message Message can have html part also | ||
d.append(message.text_part.get_payload().decode(message.text_part.charset)+"\n") # fetch the textpart | ||
#get_payload() method that returns the email’s body as a value of the bytes data type But this still isn’t a string value that we can use. | ||
#decode() method takes one argument: the message’s character encoding, | ||
#stored in the text_part.charset or html_part.charset attribute. This, finally, will return the string of the email’s body. | ||
imapObj.logout() | ||
print("Logged out successfully from server...") | ||
|
||
with open("E:\email2.txt", 'w') as fp: | ||
for i in range(len(d)): | ||
fp.write(str(d[i])) | ||
|
||
|
||
file = open("E:\email2.txt") | ||
split_it=[] | ||
for line in file: | ||
line=line.strip() | ||
split_it+=line.split() # split() returns list of all the words in the string | ||
|
||
|
||
# Pass the split_it list to instance of Counter class. | ||
Counter = Counter(split_it) | ||
# most_common() produces k frequently encountered | ||
# input values and their respective counts. | ||
print( "most common word found in EMails") | ||
num=int(input("How many most common words you want to find")) | ||
most_occur = Counter.most_common(num) | ||
for com in most_occur: | ||
print(com[0],"=>",com[1]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# program to find out all anagram of given word | ||
# made by : rakesh kumar | ||
|
||
from itertools import permutations | ||
|
||
def words(letters): | ||
yield from map(''.join, permutations(letters, len(letters))) | ||
|
||
result = set() | ||
for word in words('Compute'): | ||
result.add(word) | ||
|
||
print(f' There are {len(result)} combinations') | ||
print(result) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,5 +3,5 @@ | |
d= 10 | ||
a= a+2 | ||
b = b-20 | ||
a= c-30 | ||
a= b-30 | ||
print(a) |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
from __future__ import unicode_literals | ||
import youtube_dl | ||
import urllib | ||
import shutil | ||
# import urllib | ||
# import shutil | ||
ydl_opts = {} | ||
with youtube_dl.YoutubeDL(ydl_opts) as ydl: | ||
ydl.download(['https://www.youtube.com/watch?v=a8aDcLk4vRc&list=PLeo1K3hjS3uset9zIVzJWqplaWBiacTEU&index=2']) | ||
ydl.download(['https://www.youtube.com/watch?v=N5vscPTWKOk']) |