Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 1530a29

Browse files
style: format code with autopep8
Format code with autopep8 This commit fixes the style issues introduced in 1d7fbbc according to the output from Autopep8. Details: https://app.deepsource.com/gh/avinashkranjan/Amazing-Python-Scripts/transform/bb09b6c2-9305-4450-9c69-f7b33d7068ef/
1 parent 1d7fbbc commit 1530a29

File tree

3 files changed

+29
-20
lines changed

3 files changed

+29
-20
lines changed

‎Automated GoogleSearch using Python/code.py‎

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from googlesearch import search
22
import sys
33

4+
45
class googlesearch:
56

67
def __init__(self):
@@ -23,7 +24,8 @@ def set_search_text(self):
2324
def perform_search(self):
2425
try:
2526
# Perform the Google search
26-
results = search(self.keyword_to_search, num_results=self.search_count)
27+
results = search(self.keyword_to_search,
28+
num_results=self.search_count)
2729
self.search_results = results
2830
except Exception as e:
2931
print(e)
@@ -32,7 +34,8 @@ def perform_search(self):
3234
print("Google search performed successfully")
3335

3436
def print_search_res(self):
35-
print("The search results for {} keyword are:".format(self.keyword_to_search))
37+
print("The search results for {} keyword are:".format(
38+
self.keyword_to_search))
3639

3740
count = 1
3841
for search_res in self.search_results:
@@ -44,18 +47,18 @@ def print_search_res(self):
4447
def main():
4548
google_search_bot = googlesearch()
4649

47-
while True:
48-
print("Select any one of the valid operations which are listed below:")
49-
print("1. To set the number of searches we need to display for each Google Search.")
50-
print("2. To enter the keyword for the Google Search.")
51-
print("3. To perform Google Search for the keyword entered by the user.")
52-
print("4. To print the Google search results obtained after searching.")
53-
print("5. To exit from the code execution.")
54-
50+
while True:
51+
print("Select any one of the valid operations which are listed below:")
52+
print("1. To set the number of searches we need to display for each Google Search.")
53+
print("2. To enter the keyword for the Google Search.")
54+
print("3. To perform Google Search for the keyword entered by the user.")
55+
print("4. To print the Google search results obtained after searching.")
56+
print("5. To exit from the code execution.")
57+
5558
choice = int(input(''))
5659

57-
if choice == 1:
58-
google_search_bot.set_search_count()
60+
if choice == 1:
61+
google_search_bot.set_search_count()
5962
elif choice == 2:
6063
google_search_bot.set_search_text()
6164
elif choice == 3:
@@ -65,11 +68,12 @@ def main():
6568
else choice == 5:
6669
sys.exit()
6770

68-
print("To continue with the code execution, enter 'y' or 'n':")
69-
continue_or_exit = input()
70-
71-
if continue_or_exit == 'n' or continue_or_exit == 'N':
72-
sys.exit()
71+
print("To continue with the code execution, enter 'y' or 'n':")
72+
continue_or_exit = input()
73+
74+
if continue_or_exit == 'n' or continue_or_exit == 'N':
75+
sys.exit()
76+
7377

7478
if __name__ == '__main__':
7579
main()

‎FileDownload Automationi/script.py‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import requests
22

3+
34
def download_file(url, save_path, file_name):
45
"""
56
Download a file from a given URL and save it to a specified directory.
6-
7+
78
Parameters:
89
- url (str): The URL of the file to be downloaded.
910
Get the URL of download button through it's inspect button.
@@ -16,6 +17,7 @@ def download_file(url, save_path, file_name):
1617
file.write(response.content)
1718
print("File downloaded successfully!")
1819

20+
1921
# Example URL
2022
file_url = "https://files.ceenaija.com/wp-content/uploads/music/2022/09/Keane_-_Somewhere_Only_We_Know_CeeNaija.com_.mp3"
2123

‎MultipleTimes_Website_opener/code.py‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import webbrowser # Import the webbrowser module
22

3-
n = int(input('enter how many times you want to open website?')) # Prompt user for the number of times to open the website
3+
# Prompt user for the number of times to open the website
4+
n = int(input('enter how many times you want to open website?'))
45

56
for e in range(n): # Loop 'n' times
6-
webbrowser.open_new_tab('https://github.com/avinashkranjan/Amazing-Python-Scripts') # Open the specified website in a new tab
7+
# Open the specified website in a new tab
8+
webbrowser.open_new_tab(
9+
'https://github.com/avinashkranjan/Amazing-Python-Scripts')

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /