I'm looking to grab a url that begins with http:// or https:// from a textfile that also contains other unrelated text and transfer it to another file/list.
def test():
with open('findlink.txt') as infile, open('extractlink.txt', 'w') as outfile:
for line in infile:
if "https://" in line:
outfile.write(line[line.find("https://"): line.find("")])
print("Done")
The code currently does nothing.
Edit: I see this is being negatively voted like usual, is there anything I can add here?
This is not a duplicate, please re-read carefully.