import sys
import datetime
import requests
from bs4 import BeautifulSoup
def getYoutubeTags():
link = input("Enter link ")
request = requests.get(link)
html = BeautifulSoup(request.content,"html.parser")
tags = html.find_all("meta",property="og:video:tag")
for tag in tags:
now = datetime.datetime.now()
print(tag['content'])
print(tag['content'], now.strftime("%Y-%m-%d %H:%M"), file=open('output.txt', 'a'), )
getYoutubeTags()
now i want that everytime it creates an outpot.txt file if i am taking another tags from a video it will create a new one
i tried making a loop that detects if there is already an outpot.txt file exists and if so create a new one but i couldn't manage to figure out how to do that i need some guidance ;-;
side note i am only 1 week into python