python - changing specific letters in a string -


from random import randint tal = ['0','1','2','3','4','5','6','7','8','9'] sign = ['@','£','$','€','&', '!', '?', '!'] bogstaver = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',              'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'x', 'y', 'z']    numbers = [tal[randint(0,9)] + sign[randint(0,7)] + bogstaver[randint(0,24)] + tal[randint(0,9)] x in range(4)] password = "".join(numbers) print(password[2::8])  print(password) 

i want every 4., starting second first letter in password uppercase letter in string. [2::8] of code. cant figure out how replace these 2 letters same letter in uppercase. help?

password = ''.join([c.upper()                     if in range(2, len(password), 8)                     else c                     i, c in enumerate(password)]) 

Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -