I've been trying to make my program read a different line from a file each time the loop is completed. This works the first time but once the first loop is completed I am presented with IndexError: list index out of range. How can I fix this?
The file titled s is 18239 lines long and the file titled sp is 1000 lines long.
from itertools import count
import time
import webbrowser
import pynput
from pynput.keyboard import Key, Listener, Controller
import random
import string
import secrets
number = random.randint(0,18238)
number2 = random.randint(0,18238)
kb = Controller()
cout = 0
f = open('D:\Scripts\sp.txt', 'r')
fi = open('D:\Scripts\s.txt', 'r')
fil = open('D:\Scripts\s.txt', 'r')
while cout < 1000:
linecount = random.randint(0,999)
line = f.readlines()[linecount]
lines = line.split()
email = lines[0]
password= lines[1]
name = fi.readlines()[number]
name2 = fil.readlines()[number2]
firstname = name.rstrip("\n")
lastname = name2.rstrip("\n")