Is there a way where i can limit the array output results?


Joined
Oct 19, 2022
Messages
1
Reaction score
0
There's 52 web results, and want to limit the total output to 10
Python:
Combined = open("dictionaries/Combined.txt", 'r', encoding="utf-8")
Abused = open("dictionaries/Abused.txt", 'r', encoding="utf-8")
Example = open("dictionaries/examples.txt", 'w', encoding="utf-8")

Python:
for web_Test in Combined:
    Combined_result = re.search(r"([\w-]+\.)*\w+[\w-]*", web_Test)
    Text_Test = (Combined_result.group())
    Example.write((Text_Test+'.web'+'.co.id'+"\n"))
    #print(Text+'.bni'+'.co.id')

Python:
with open("dictionaries/examples.txt") as f:
    websamples = [line.rstrip() for line in f]

Python:
print (websamples)

And here is the output

1666174793063.png


How do i reduce the number of array outputs?
Thank you!
 
Ad

Advertisements

Joined
May 11, 2022
Messages
58
Reaction score
5
so that's fairly straight forward, simply have a counter for how many have been made so far and then break out of the loop when you reach 10.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top