73422/what-the-python-logic-count-the-number-capital-letters-file
Can anyone explain how to count the number of capital letters in a file?
Hi,
You can use this piece of code, I hope this will help you:
import os os.chdir('C:\\Users\\lifei\\Desktop') with open('Today.txt') as today: count=0 for i in today.read(): if i.isupper(): count+=1 print(count)
n = int (input ('ENTER NUMBER TO ...READ MORE
a = int (input('enter number')) num = a sum ...READ MORE
Assumming a is a string. The Slice ...READ MORE
Hi. Nice question. Here is the simplified answer ...READ MORE
You can also use the random library's ...READ MORE
Syntax : list. count(value) Code: colors = ['red', 'green', ...READ MORE
Enumerate() method adds a counter to an ...READ MORE
You can simply the built-in function in ...READ MORE
To count the number of appearances: from collections ...READ MORE
A module is a file containing a ...READ MORE
OR
At least 1 upper-case and 1 lower-case letter
Minimum 8 characters and Maximum 50 characters
Already have an account? Sign in.