I want to know how I can print the username of the Instagram account by the link the user will provide using python. Image attached for better understanding.
Advertisement
Answer
As you mentioned, the Instagram link should be something like this:
link = "https://www.instagram.com/instagram"
What you can do, is split the string using /
as separator, which turns it into a list, and from there get the last value of it:
username = link.split('/')[-1]