Initial upload
This commit is contained in:
commit
bf8a8f965d
7 changed files with 77 additions and 0 deletions
2
README.md
Normal file
2
README.md
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
# Six Quick Python Projects
|
||||||
|
Based on the tutorial video from [freeCodeCamp by Code With Tomi](https://www.youtube.com/watch?v=SqvVm3QiQVk).
|
||||||
13
bulk_renamer.py
Normal file
13
bulk_renamer.py
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
import os
|
||||||
|
|
||||||
|
def main():
|
||||||
|
i = 0
|
||||||
|
path = input("Input a path with png files to rename: ").replace("\\", "/") + "/"
|
||||||
|
for filename in os.listdir(path):
|
||||||
|
my_dest = f"img_{str(i)}.{filename.rsplit('.')[-1]}"
|
||||||
|
my_source = path + filename
|
||||||
|
my_dest = path + my_dest
|
||||||
|
os.rename(my_source, my_dest)
|
||||||
|
i += 1
|
||||||
|
|
||||||
|
main()
|
||||||
14
countdown.py
Normal file
14
countdown.py
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
import time
|
||||||
|
|
||||||
|
def countdown(t):
|
||||||
|
while t:
|
||||||
|
mins, secs, = divmod(t, 60)
|
||||||
|
timer = '{:02d}:{:02d}'.format(mins, secs)
|
||||||
|
print(timer, end="\r")
|
||||||
|
time.sleep(1)
|
||||||
|
t -= 1
|
||||||
|
print('Countdown complete!')
|
||||||
|
|
||||||
|
t = input("Enter the time in seconds: ")
|
||||||
|
|
||||||
|
countdown(int(t))
|
||||||
13
encode_qrcode.py
Normal file
13
encode_qrcode.py
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
import qrcode
|
||||||
|
|
||||||
|
data = input("Type anything you want to decode into a QR code: ")
|
||||||
|
|
||||||
|
qr = qrcode.QRCode(version = 1, box_size=10, border=5)
|
||||||
|
|
||||||
|
qr.add_data(data)
|
||||||
|
|
||||||
|
qr.make(fit=True)
|
||||||
|
|
||||||
|
img = qr.make_image(fill_color = 'blue', back_color = 'white')
|
||||||
|
|
||||||
|
img.save('./testimgs/myqrcode.png')
|
||||||
9
github_profile_picture.py
Normal file
9
github_profile_picture.py
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
import requests
|
||||||
|
from bs4 import BeautifulSoup as bs
|
||||||
|
|
||||||
|
github_user = input('Input GitHub User: ')
|
||||||
|
url = f'https://github.com/{github_user}'
|
||||||
|
r = requests.get(url)
|
||||||
|
soup = bs(r.content, 'html.parser')
|
||||||
|
profile_image = soup.find('img', {'alt' : 'Avatar'})['src']
|
||||||
|
print(profile_image)
|
||||||
14
password_generator.py
Normal file
14
password_generator.py
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
import random
|
||||||
|
|
||||||
|
chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*?0123456789'
|
||||||
|
|
||||||
|
print('Welcome To Your Password Generator')
|
||||||
|
number = int(input("How many passwords would you like to generate? "))
|
||||||
|
length = int(input("Enter a password length? "))
|
||||||
|
|
||||||
|
print("\nHere are your passwords:")
|
||||||
|
for pwd in range(number):
|
||||||
|
passwords = ''
|
||||||
|
for c in range(length):
|
||||||
|
passwords += random.choice(chars)
|
||||||
|
print(passwords)
|
||||||
12
weather_request.py
Normal file
12
weather_request.py
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
import os
|
||||||
|
import requests
|
||||||
|
from pprint import pprint
|
||||||
|
from decouple import config
|
||||||
|
|
||||||
|
key = config('WEATHER_API_KEY')
|
||||||
|
city = input("Enter a city: ")
|
||||||
|
base_url = f"http://api.openweathermap.org/data/2.5/weather?appid={key}&q={city}"
|
||||||
|
weather_data = requests.get(base_url).json()
|
||||||
|
|
||||||
|
# pprint(weather_data)
|
||||||
|
print(weather_data['weather'][0]['description'])
|
||||||
Loading…
Add table
Add a link
Reference in a new issue