ScottBaba8 / Youtube_titles_study

0 stars 0 forks source link

Step 1 Data gathering #2

Open ScottBaba8 opened 10 months ago

ScottBaba8 commented 10 months ago

I need an efficient way of gathering data for my tables. manually counting each letter will be inefficient.

ScottBaba8 commented 10 months ago

find the amount of each letter in the title

def letters(text): value_map = {} while text != "": num = (text.count(text[0].lower())+(text.count(text[0].upper()))) removeU = text[0].upper() removeL = text[0].lower() value_map[text[0]] = num text = text.replace(removeU, "") text = text.replace(removeL, "") print(value_map) this is a quick function to allow me to find the amount of each letter in a title