For getting the usernames and passwords from a file, you can just use:
f = open(path_to_file)
infolist = f.readlines()
f.close()
This will put a new item in the list for every line in the file, meaning you just have to put the usernames and passwords each on their own line. Be careful because putting passwords in a text file is generally not very secure, so make sure you are aware of the risks.
As for the second part, I would create a list that can be filled with threads using a for loop, the range of which is specified by the user input. Then during the iteration, give the "args" argument certain items of the credentials list that are needed for its task. Example below:
from threading import *
def spawnScraper(username, password):
print(f'{username} and {password}')
## run the instance here
def main():
#f = open(path_to_file)
#infolist = f.readlines()
#f.close()
# ^ above code to retrieve data from file
infolist = ['user1', 'pass1', 'user2', 'pass2'] # using for demonstration
threadnum = int(input('num >>> '))
threads = [] # create list to store threads
for threaditem in range(threadnum):
uname = infolist[threaditem*2] # get information from infolist
pword = infolist[threaditem*2+1]
threads.append(Thread(target=spawnScraper, args=[uname, pword])) # create thread
threads[-1].start() # start thread
main()
Make sure to uncomment the file opening section for actual intergration into your program. If you have any other questions, be sure to comment below.