how to create a password in python 1 alphabet 1 digit 1character

0 votes
Sep 18, 2020 in Python by GHAZALA
• 160 points
786 views

1 answer to this question.

0 votes

You can make use of this: 

^(?=.*[a-zA-Z])(?=.*\d)(?=.*[!@#$%^&*()_+])[A-Za-z\d][A-Za-z\d!@#$%^&*()_+]{7,19}$
  • [A-Za-z\d] Ensures that the first character is an alphabet or digit.

  • [A-Za-z\d!@#$%^&*()_+]{7,19} will match minimum 7 maximum 19 character. This is required as he presceding character class would consume a single character making the total number of characters in the string as minimum 8 and maximum 20.

  • $ Anchors the regex at the end of the string. Ensures that there is nothing following our valid password

answered Sep 18, 2020 by Roshni
• 10,480 points

Related Questions In Python

–1 vote
2 answers
0 votes
1 answer

How to create and read from a temporary file in Python?

Hi, there is a very simple solution ...READ MORE

answered Jan 29, 2019 in Python by Nymeria
• 3,560 points
2,043 views
0 votes
1 answer

How to create a GUID/UUID in Python

The uuid module, in Python 2.5 and ...READ MORE

answered Jan 29, 2019 in Python by SDeb
• 13,300 points
1,788 views
–1 vote
2 answers
0 votes
1 answer

How to create a function like f(y) = xy^2 in Python?

This is very easy. have a look ...READ MORE

answered Aug 5, 2019 in Python by Neel
• 3,020 points

edited Aug 6, 2019 by Kalgi 2,149 views
0 votes
1 answer

How to create a zip archive of a directory in Python?

Hello @kartik, The easiest way is to use shutil.make_archive. ...READ MORE

answered May 11, 2020 in Python by Niroj
• 82,840 points
631 views
0 votes
1 answer

How to create a unicode string in python with the string eg: This is a string?

Hey, @Roshni, It is very simple to execute, ...READ MORE

answered Jun 23, 2020 in Python by Gitika
• 65,770 points
791 views
0 votes
1 answer

How to create lambda function inside a list in Python?

Hi@akhtar, The lambda statement can appear in places ...READ MORE

answered Jun 25, 2020 in Python by MD
• 95,460 points
631 views
+1 vote
5 answers

how to exit a python script in an if statement

Instead of using the normal UTF-8 encoding, ...READ MORE

answered Jul 4, 2023 in Python by bodymist
• 140 points
355,315 views
0 votes
1 answer

How to dynamically load a module in Python?

Hi, Dynamic loading is where we do not ...READ MORE

answered Jun 26, 2020 in Python by Roshni
• 10,480 points
1,778 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP