0

this is my piece of code

        run_command("clear")
        print("Initializing Scraper .........")
        time.sleep(2)
        username = input("Enter your instagram Username : ")
        password = input("Enter your instagram Password : ")
        targeted_account = input("Username of account which needs to be scraped : ")
        print("Running Scraper...")
        time.sleep(2)
        command = "instagram-scraper {victim} -u {username} -p {password}"
        run_command("command")

i want python to run the command with those variables and i cant figure out how to do that.

  • you want to execute terminal commands with python? https://stackoverflow.com/questions/89228/how-to-execute-a-program-or-call-a-system-command –  Feb 17 '22 at 16:23

1 Answers1

0

Use subprocess:

import subprocess
subprocess.run(['instagram-scraper', victim, '-u', username, '-p', password])
Douglas Leeder
  • 52,368
  • 9
  • 94
  • 137