This file contains hidden or 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
from textblob import TextBlob | |
testimonial = TextBlob("Textblob is amazingly simple to use. What great fun!") | |
testimonial.sentiment |
This file contains hidden or 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
from win10toast import ToastNotifier | |
toaster = ToastNotifier() | |
header = 'Medium Article' | |
text = 'Its the correct time to start writing your article' | |
toaster.show_toast(f"{header}",f"{text}",duration=10,threaded=True) | |
while toaster.notification_active(): time.sleep(0.005) |
This file contains hidden or 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
from playsound import playsound | |
playsound('PATH_TO_AUDIO_FILE') |
This file contains hidden or 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
import webbrowser | |
webbrowser.open("https://stackoverflow.com") |
This file contains hidden or 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
from dateutil.relativedelta import * | |
from dateutil.easter import * | |
from dateutil.rrule import * | |
from dateutil.parser import * | |
from datetime import * | |
now = parse("Tue 11 17:13:46 Dec UTC 2020") | |
today = now.date() | |
year = rrule(YEARLY,dtstart=now,bymonth=8,bymonthday=13,byweekday=FR)[0].year | |
rdelta = relativedelta(easter(year), today) | |
print("Today is: %s" % today) |
This file contains hidden or 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
import requests | |
url = " http://newsapi.org/v2/top-headlines?country=us&apiKey=YOU_API_KEY" | |
page = requests.get(url).json() | |
article = page["articles"] | |
results = [] | |
for ar in article: | |
results.append(ar["title"]) | |
for i in range(10): ### Top 10 News ### Use len(results) to get all the top 20 news | |
print(i + 1, results[i]) | |
This file contains hidden or 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
import requests | |
import time | |
res = requests.get(''https://sv443.net/jokeapi/v2/joke/Any") | |
joke = res.json() | |
joke['setup'] | |
time.sleep(3) | |
joke['delivery'] | |
-------------------------------- | |
What do you call a developer who doesn't comment code? |
This file contains hidden or 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
import requests | |
res = requests.get(''http://numbersapi.com/7/math") | |
print(res.text) | |
---------------------- | |
7 is the lowest number that cannot be represented as the sum of the squares of three integers. | |
res = requests.get("http://numbersapi.com/3/31/date") | |
print(res.text) | |
-------------------------------- | |
March 31st is the day in 1909 that Serbia accepts Austrian control over Bosnia and Herzegovina. |
This file contains hidden or 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
import requests | |
url = "link-to-webpage" | |
apiKey = "your-api-key" | |
linkRequests = f"https://api.html2pdf.app/v1/generate?url={url}&apiKey={apikey}" | |
result = requests.get(linkRequests).content | |
with open("document.pdf", "wb") as handler: | |
handler.write(result) |
This file contains hidden or 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
import requests | |
res = requests.get('https://api.quotable.io/random') | |
quote = res.json() | |
quote['content'] | |
---------------------------------------- | |
When I let go of what I am, I become what I might be. |