Skip to content

Commit 1edf01f

Browse files
committed
Merge branch 'prathimacode-hub:main' into alpha
2 parents 482f61e + 25481e3 commit 1edf01f

File tree

10 files changed

+110
-2
lines changed

10 files changed

+110
-2
lines changed

Diff for: BasicPythonScripts/PC Cleaner/Images/output_1.jpg

68.4 KB
Loading

Diff for: BasicPythonScripts/PC Cleaner/Images/output_2.jpg

73 KB
Loading

Diff for: BasicPythonScripts/PC Cleaner/README.md

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
![](http://ForTheBadge.com/images/badges/made-with-python.svg)
2+
![](https://forthebadge.com/images/badges/built-by-developers.svg)</br>
3+
[![Prettier](https://img.shields.io/badge/Code%20Style-Prettier-red.svg)](https://github.com/prettier/prettier)
4+
![License](https://img.shields.io/badge/License-MIT-red.svg)</br>
5+
6+
## Description:
7+
- Let's [**look**](https://github.com/Iamtripathisatyam/Awesome_Python_Scripts/blob/main/BasicPythonScripts/PC%20Cleaner/pc_cleaner.py) at a Python script that will place all of your files in the appropriate folder.
8+
- This script will first list all of the files and place them in folders based on their extensions, such as "**.pdf**" which will be placed in the **PDFs folder**, and so on for all of the files.
9+
- Finally, all of the files will be placed in their proper directories.
10+
11+
## Procedure to follow:
12+
- Import **OS** module
13+
- Using the **chdir** function, change the location where the files will be imported.
14+
- List all of the files using the **listdir** function, and then delete any files that don't have an extension like any folder.
15+
- Run a loop for all of the files, putting them in the appropriate folders based on their extensions.
16+
- Finally, each file will be placed in its own folder.
17+
18+
## Sample Output:
19+
20+
### Before:
21+
22+
![hey](https://github.com/Iamtripathisatyam/Awesome_Python_Scripts/blob/main/BasicPythonScripts/PC%20Cleaner/Images/output_1.jpg)
23+
24+
### After:
25+
26+
![hey](https://github.com/Iamtripathisatyam/Awesome_Python_Scripts/blob/main/BasicPythonScripts/PC%20Cleaner/Images/output_2.jpg)
27+

Diff for: BasicPythonScripts/PC Cleaner/pc_cleaner.py

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Import the module
2+
import os
3+
4+
# Function for creating new folder
5+
6+
7+
def create_folder(folder):
8+
if not os.path.exists(folder):
9+
os.mkdir(folder) # Make a folder with the name given by the user
10+
11+
# Function to move files inside the folder
12+
13+
14+
def move_files(folder_name, files):
15+
for file in files:
16+
# Moving all the files inside the folder
17+
os.replace(file, f"{folder_name}/{file}")
18+
19+
20+
# Driver function
21+
if __name__ == "__main__":
22+
path = r"C:\Users\Dell\Downloads\All"
23+
os.chdir(path) # Jump to the directory where all the files present
24+
all_files = os.listdir() # List all the files of the directory
25+
for i in range(len(all_files)):
26+
try:
27+
# Check only for the files not for the folders
28+
all_files[i] = "."+all_files[i].split(".")[1]
29+
except:
30+
pass # If it'a a folder then nothing to do
31+
# List all the files which contains extension, not folders because folders don;t have any extension
32+
all_files = [file for file in all_files if "." in file]
33+
34+
for file in all_files: # Loop for arranging all the files in a separate folders
35+
folder_name = f"{file[1:].upper()} Files"
36+
create_folder(folder_name)
37+
files = [fil for fil in os.listdir() if os.path.splitext(fil)
38+
[1] == file]
39+
move_files(folder_name, files)

Diff for: BasicPythonScripts/PC Cleaner/requirements.txt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import os

Diff for: README.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -161,14 +161,16 @@ Thanks goes to these amazing people for their contributions 🎉🎉🎉
161161
<td align="center"><a href="https://github.com/jigar-sable"><img src="https://avatars.githubusercontent.com/u/64949957?v=4" width="80px;" alt=""/><br /><sub><b>Jigar Sable</b></sub></a><br /><a href="https://github.com/prathimacode-hub/Awesome_Python_Scripts/commits?author=jigar-sable" title="Code">💻</a> <a href="https://github.com/prathimacode-hub/Awesome_Python_Scripts/commits?author=jigar-sable" title="Documentation">📖</a></td>
162162
<td align="center"><a href="https://github.com/Aditya8821"><img src="https://avatars.githubusercontent.com/u/62375127?v=4" width="80px;" alt=""/><br /><sub><b>Aditya Trivedi</b></sub></a><br /><a href="https://github.com/prathimacode-hub/Awesome_Python_Scripts/commits?author=Aditya882" title="Code">💻</a> <a href="https://github.com/prathimacode-hub/Awesome_Python_Scripts/commits?author=Aditya882" title="Documentation">📖</a></td>
163163
<td align="center"><a href="https://github.com/https://github.com/Bhuvanaa28"><img src="https://avatars.githubusercontent.com/u/76595007?v=4" width="80px;" alt=""/><br /><sub><b>Bhuvanaa</b></sub></a><br /><a href="https://github.com/prathimacode-hub/Awesome_Python_Scripts/commits?author=Bhuvanaa28" title="Code">💻</a> <a href="https://github.com/prathimacode-hub/Awesome_Python_Scripts/commits?author=Bhuvanaa28" title="Documentation">📖</a></td>
164-
<td align="center"><a href="https://github.com/Harshitha-246"><img src="https://avatars.githubusercontent.com/u/76912557?v=4" width="80px;" alt=""/><br /><sub><b>Hashitha.K</b></sub></a><br /><a href="https://github.com/prathimacode-hub/Awesome_Python_Scripts/commits?author=Harshitha-246" title="Code">💻</a> <a href="https://github.com/prathimacode-hub/Awesome_Python_Scripts/commits?author=Harshitha-246" title="Documentation">📖</a></td>
164+
<td align="center"><a href="https://github.com/Harshitha-246"><img src="https://avatars.githubusercontent.com/u/76912557?v=4" width="80px;" alt=""/><br /><sub><b>Harshitha.K</b></sub></a><br /><a href="https://github.com/prathimacode-hub/Awesome_Python_Scripts/commits?author=Harshitha-246" title="Code">💻</a> <a href="https://github.com/prathimacode-hub/Awesome_Python_Scripts/commits?author=Harshitha-246" title="Documentation">📖</a></td>
165165
<td align="center"><a href="https://github.com/hr1shu"><img src="https://avatars.githubusercontent.com/u/57145318?v=4" width="80px;" alt=""/><br /><sub><b>Rishav Kumar</b></sub></a><br /><a href="https://github.com/prathimacode-hub/Awesome_Python_Scripts/commits?author=hr1shu" title="Code">💻</a> <a href="https://github.com/prathimacode-hub/Awesome_Python_Scripts/commits?author=hr1shu" title="Documentation">📖</a></td>
166166
<td align="center"><a href="https://github.com/AmitGupta700"><img src="https://avatars.githubusercontent.com/u/62374061?v=4" width="80px;" alt=""/><br /><sub><b>Amit Gupta</b></sub></a><br /><a href="https://github.com/prathimacode-hub/Awesome_Python_Scripts/commits?author=AmitGupta700" title="Code">💻</a> <a href="https://github.com/prathimacode-hub/Awesome_Python_Scripts/commits?author=AmitGupta700" title="Documentation">📖</a></td>
167167
</tr>
168168
<tr>
169169
<td align="center"><a href="https://github.com/Jagannath8"><img src="https://avatars.githubusercontent.com/u/64650848?v=4" width="80px;" alt=""/><br /><sub><b>Jagannath Pal</b></sub></a><br /><a href="https://github.com/prathimacode-hub/Awesome_Python_Scripts/commits?author=Jagannath8" title="Code">💻</a> <a href="https://github.com/prathimacode-hub/Awesome_Python_Scripts/commits?author=Jagannath8" title="Documentation">📖</a></td>
170170
<td align="center"><a href="https://github.com/Manasa2811"><img src="https://avatars.githubusercontent.com/u/57994923?v=4" width="80px;" alt=""/><br /><sub><b>Manasa Rayachoti</b></sub></a><br /><a href="https://github.com/prathimacode-hub/Awesome_Python_Scripts/commits?author=Manasa2811" title="Code">💻</a> <a href="https://github.com/prathimacode-hub/Awesome_Python_Scripts/commits?author=Manasa2811" title="Documentation">📖</a></td>
171-
</tr>
171+
<td align="center"><a href="https://github.com/LasyaGanesuni"><img src="https://avatars.githubusercontent.com/u/66461307?v=4" width="80px;" alt=""/><br /><sub><b>Lasya Ganesuni</b></sub></a><br /><a href="https://github.com/prathimacode-hub/Awesome_Python_Scripts/commits?author=LasyaGanesuni" title="Code">💻</a> <a href="https://github.com/prathimacode-hub/Awesome_Python_Scripts/commits?author=LasyaGanesuni" title="Documentation">📖</a></td>
172+
<td align="center"><a href="https://github.com/Komal-99"><img src="https://avatars.githubusercontent.com/u/74819092?v=4" width="80px;" alt=""/><br /><sub><b>Komal Gupta</b></sub></a><br /><a href="https://github.com/prathimacode-hub/Awesome_Python_Scripts/commits?author=Komal-99" title="Code">💻</a> <a href="https://github.com/prathimacode-hub/Awesome_Python_Scripts/commits?author=Komal-99" title="Documentation">📖</a></td>
173+
</tr>
172174
</table>
173175

174176
<!-- markdownlint-enable -->
Loading

Diff for: WebScrapingScripts/Real-Time Bitcoin Rate/README.md

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
## Description:
2+
[**Here**](https://github.com/Aditya8821/Awesome_Python_Scripts/blob/main/WebScrapingScripts/Real-Time%20Bitcoin%20Rate/Bitcoin%20Rate.py) is Python Script which checks the Real-Time Bitcoin rates in INR.
3+
4+
- **BeautifulSoup:**
5+
BeautifulSoup is a python library for pulling data out of HTML and XML files
6+
7+
- **requests:**
8+
requests module allows you to send HTTP requests and returns a response object with all the response
9+
10+
## **Real-Time Use & Purpose:**
11+
In this project you’ll learn about HTTP requests and how to send them using the requests package and will also learn how to extract required data from HTML pages using some simple functions of beautifulsoup module.
12+
As we all know very well that bitcoin price is a fickle thing. You never really know where it’s going to be at the end of the day. So, instead of constantly checking various sites for the latest updates, let’s make a Python script to do the work for you.
13+
14+
## Procedure to follow:
15+
- from bs4 import BeautifulSoup
16+
- import requests
17+
- pass page text as argument in BeautifulSoup and parse it.
18+
- pass required class name as argument in soup.find() function.
19+
- print the output in terms of INR
20+
## Sample Output:
21+
<p align="center"><img src="https://github.com/Aditya8821/Awesome_Python_Scripts/blob/main/WebScrapingScripts/Real-Time%20Bitcoin%20Rate/Images/Demo%20Output.png"></p>
22+
23+
For any queries please contact?
24+
- [**LinkedIn**](https://www.linkedin.com/in/aditya-trivedi-032090164/)
+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# BeautifulSoup is a python library for pulling data out of HTML and XML files
2+
from bs4 import BeautifulSoup as BS
3+
# requests module allows you to send HTTP requests and returns a Response Object with all the response​.
4+
import requests
5+
def get_price(url):
6+
data=requests.get(url) # Accessing all required data from url site and store in data.
7+
soup=BS(data.text,"html.parser") # It takes text of page as argument and then parse it with html.parser
8+
ans=soup.find("div",class_="BNeawe iBp4i AP7Wnd").text # here the class name is passed as argument to find out that particular info in html text
9+
return ans
10+
url="https://www.google.com/search?q=bitcoin+price"
11+
ans=get_price(url)
12+
print("1 Bitcoin = ",ans)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Python= https://www.python.org/
2+
BeautifulSoup= https://pypi.org/project/beautifulsoup4/
3+
requests= https://pypi.org/project/requests/

0 commit comments

Comments
 (0)