Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4621568
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T02:43:12+00:00 2026-05-22T02:43:12+00:00

I am designing a password recovery program, and I want to make it right/modular

  • 0

I am designing a password recovery program, and I want to make it “right”/modular enough to be plugged into other programs, so I am trying to avoid ugly hacks.

Here’s the rundown: I have a list with a string

myString = "Hey what's up?"
myString2DList = [
    myString,
    ]

Now I have a 2D list with a single row. All I want to do is add columns (could be lists themselves) under the users-specified index

So, there could be say 3 indexes (that correspond to a column)
like: 0,4,6 (H,w,a)
and now I just want to dynamically append anything to those columns. I have done searches and not much has helped (I did see some promising posts that mentioned that the Dict data type might be better to use here), and I feel totally stuck…

Edit/To clarify:

Basically, the first row will be representing a password that the user wants to recover. Let’s say the user can’t remember their password but can remember at least a few characters. I want the columns to represent each possible alternative for each character, then my script will brute force the password with constraints. I already coded an ugly script that does the same thing, I just have to recode the thing for every password, I want to make it dynamic because it REALLY came in handy.

Thanks!

  • 1 1 Answer
  • 3 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T02:43:12+00:00Added an answer on May 22, 2026 at 2:43 am

    It’s not immediately clear to me what you’re trying to do. The closest thing to a 2D array that Python has is a list of lists. What you have now is single list, though, not a 2D list. A 2D list would look like this (replace these names with more meaningful ones):

    list_of_lists = [[header0,  header1,  header2 ],
                     [r1c0data, r1c1data, r1c2data],
                     [r2c0data, r2c1data, r2c2data]]
    

    To append a row, you just add a list (i.e. list_of_lists.append(new_list)). To append a column, you’d have to add an item to the end of teach list like so:

    c4data = [header3, r1c3data, r2c3data]
    for i, row in enumerate(list_of_lists):
        row.append(c4data[i])
    

    If you really want 2D arrays, you might be better off using numpy.array.

    But is your desire to index individual rows by column heading? If so, you’d be better off using a list of dictionaries:

    list_of_dicts = [{'column0':r0c0data, 'column1':r0c1data, 'column2':r0c2data},
                     {'column0':r1c0data, 'column1':r1c1data, 'column2':r1c2data}]
    

    You could even cut that down to one dict, using tuples to address individual elements:

    tuple_key_dict = {(0, 0):r0c0data, (0, 1):r0c1data, (0, 2):r0c2data,
                      (0, 1):r0c1data, (1, 1):r1c1data, (1, 2):r1c2data}
    

    Each of these methods are suited to different tasks. You might even need to use a database. We need to know more about what you’re doing to tell you.


    Ok, to do what you want, there’s no need for a list of lists at all. Just create a list of strings, each of which represents the possible characters at the corresponding index of the password string. So for example, say the user used a password that was a combination of the German and English words for ‘appletree’, but can’t remember which combination:

    >>> char_list = [''.join(set((a, b))) for a, b in zip('apfelbaum', 'appletree')]
    >>> char_list
    ['a', 'p', 'pf', 'el', 'el', 'bt', 'ar', 'eu', 'em']
    

    char_list now contains all possible letters at each index. To generate all possible passwords, all you need is the cartesian product of these strings:

    >>> import itertools
    >>> password_list = [''.join(tup) for tup in itertools.product(*char_list)]
    >>> print 'appletree' in password_list
    True
    >>> print 'apfelbaum' in password_list
    True
    >>> print 'apfletrum' in password_list
    True
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently designing a login system for a make-believe company, right now all I
i am designing a project in phonegap with android. i want to make a
While designing a table my colleague here says that I should avoid identity column
I was designing a form which asks the user to type in a password
I am designing & developing Reset Password form, where user provides username/email address so
I am designing a login page as: UserName: ..... Password: ..... LoginButton When the
I'm designing an authentication system that works like the following: User enters password Salt
I'm trying to understand and figure good practices for designing your app/domain models (POCOs/DTOs).
I'm currently designing a shop system with these entities: Account (Millions), username, email, password...
Designing a generative music system for iOS, using OpenFrameworks, I'd need to provide a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.