import requests
import os.path
from pathlib import Path
from bs4 import BeautifulSoup
filename = '/var/python/liste.txt'
if not os.path.exists(filename):
open(filename, 'w').close()
# Using readlines()
# file = open(filename, 'r')
# lines = file.readlines()
# count = 0
# Strips the newline character
# for line in lines:
# print("{}: {}" . format(count, line.strip()))
# count += 1
url = "https://www.asdfghgj.com"
html = requests.get(url).content
soup = BeautifulSoup(html, "html.parser")
# list = soup.find('div', class_="footer-middle").findAll('a')
count = 0
for a in soup.select('.footer-middle a'):
....ulkeUrl = a['href']
....ulkeAdi = a.get_text(strip = True)
....print(count, ':', ulkeUrl, '/', ulkeAdi)
....count += 1
ulkeler = input('ulke seciniz: ').replace(' ', '').split(',')
for ulkei in ulkeler:
....elm = soup.select('.footer-middle a')[ulkei]
....print(elm['href'])r10'da tab yapamıyorum, 4 nokta = tab