-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbrowser.py
28 lines (21 loc) · 840 Bytes
/
browser.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
class Display:
def __init__(self, site):
self.site = site
def run(self):
with open('Websites.database', 'r') as file:
data = file.read()
data = data.split()
# If python has a function to search for the file, surely I can also get the position from that, right? TODO: Get this position to reduce cpu usage.
if self.site in data:
for r in range(len(data)):
if data[r] == self.site:
path = data[r+1]
# Formats C:\ to file:///
for l in range(len(path)):
if path[l] == '\\':
path = path[:l] + '/' + path[l+1:]
# Uses code I don't understand to open the file in Chrome
import webbrowser
new = 2
url = "file:///" + path
webbrowser.open(url,new=new)