Search This Blog

Sunday, August 14, 2011

What does [ ] mean as an output in Python?

I am trying to write code to count the number of upper case letters in a string using Python. I have written the following but instead of the code returning the number of Upper Case letters it returns []? An help would be gratefully recieved.





import re

while True:
strPassword = input("Please enter your password: ")
length = len(strPassword)
if length < 6 or length > 12:
print ("It is not the correct length")
else:
break
print ("Password OK")

upper = 0
lower = 0
number = 0

print (re.findall("A-Z", strPassword, 0))



http://bit.ly/r6jZB1

No comments:

Post a Comment