Fakultas Ilmu Komputer UI

Lab2_1_1_RulyAchmadGemilangGultom_1906399915.py 353 Bytes
Newer Older
Ruly Achmad Gemilang Gultom's avatar
Ruly Achmad Gemilang Gultom committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import urllib.request

page = urllib.request.urlopen("https://pudyprima.github.io/prices.html")
text = page.read().decode("utf8")

print(text)

cek_teks = ">$"
i = 0
Found = False

while i < len(text) -1 and not Found:
    if text[i:i+2] == cek_teks:
        Found = True
    i += 1
if Found == True:
    print(text[i:i+5])
else:
    print("tidak ada")