-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path14_python.py
More file actions
26 lines (24 loc) · 979 Bytes
/
14_python.py
File metadata and controls
26 lines (24 loc) · 979 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# 14) Write a python to read characters from the keyboard one by one all lower
# case characters get stored in the file lower.txt all upper case characters
# get stored in the file upper.txt and all other characters get stored in
# others.txt. display content of all files.
value = raw_input('enter value')
for s in value:
if s.isupper():
fupper = open('upper.txt','a+')
fupper.write(s)
fupper.close()
elif s.islower():
flower = open('lower.txt','a+')
flower.write(s)
flower.close()
else:
fothers = open('others.txt','a+')
fothers.write(s)
fothers.close()
flowerContent = open('lower.txt','a+')
print('content from lower.txt file {} : '.format(flowerContent.read()))
fupperContent = open('upper.txt','a+')
print('content from upper.txt file {} : '.format(fupperContent.read()))
fothersContent = open('others.txt','a+')
print('content from others.txt file {} : '.format(fothersContent.read()))