-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathproblem6.py
More file actions
53 lines (45 loc) · 746 Bytes
/
problem6.py
File metadata and controls
53 lines (45 loc) · 746 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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#! /usr/bin/python36
import os
option='''
press 1 to open file:
press 2 to open multiple files:
press 3 for cat -E:
press 4 for cat -n:
'''
print(option)
choice=input()
if choice == '1' :
d=input("file name ")
f=open(d,'r')
print(f.read())
elif choice == '2' :
x=[]
s=int(input("enter no of files"))
for i in range(s):
d=input("file name ")
x.append(d)
print(x)
for i in x:
f=open(i,'r')
print(f.read())
f.close()
elif choice == '3' :
d=input("enter file name ")
f=open(d,'r')
z=f.read()
x=z.split('\n')
print(x)
for i in x:
print(i+"$")
elif choice == '4' :
d=input("enter file name ")
f=open(d,'r')
z=f.read()
x=z.split('/n')
print(x)
j=1
for i in x:
print(j +i)
j=j+1
else:
print("wrong")