Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Two questions
#1
Hi guys,

I'm today start in Python so i have two questions.

1)I want to generate all possible characters.I'm do it,but i don't have idea how that I start from "abab" for example,i don't want to start from begin every time.("a")

keywords = [''.join(i) for i in product(ascii_lowercase, repeat = x)]
So i just want that I can start from certain characters.


2)
I have problem when i use repeat 6 + in this line:

keywords = [''.join(i) for i in product(ascii_lowercase, repeat = 6)]
When I use repeat = 5 all works :/

#Errors
Error:
Traceback (most recent call last): File "C:\Users\paulc\Desktop\test.py", line 15, in <module> keywords = [''.join(i) for i in product(ascii_lowercase, repeat = 6)] File "C:\Users\paulc\Desktop\test.py", line 15, in <listcomp> keywords = [''.join(i) for i in product(ascii_lowercase, repeat = 6)] MemoryError
I hope you can understand me!

Thanks

I'm fix second problem,i use:

keywords = map(''.join, product(ascii_lowercase, repeat=6))
And all is ok.
Reply


Messages In This Thread
Two questions - by jure98 - Mar-28-2018, 08:45 PM
RE: Two questions - by Larz60+ - Mar-28-2018, 09:15 PM
RE: Two questions - by jure98 - Mar-29-2018, 08:40 AM
RE: Two questions - by Larz60+ - Mar-29-2018, 09:19 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Discord bot that asks questions and based on response answers or asks more questions absinthium 1 49,777 Nov-25-2017, 06:21 AM
Last Post: heiner55

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020