File tree Expand file tree Collapse file tree 5 files changed +34
-4
lines changed Expand file tree Collapse file tree 5 files changed +34
-4
lines changed Original file line number Diff line number Diff line change
1
+ #Python program to copy odd lines of one file to other***
2
+
3
+ f1 = open ("f1.txt" ,'r' )
4
+ f2 = open ("f2.txt" ,'w' )
5
+ l1 = f1 .readlines ()
6
+
7
+
8
+ for i in range (0 ,len (l1 )):
9
+ if i % 2 == 0 :
10
+ f2 .write (l1 [i ])
11
+ f2 .close ()
12
+ f3 = open ("f2.txt" ,'r' )
13
+ cont = f3 .readlines ()
14
+ print (cont )
15
+ f3 .close ()
Original file line number Diff line number Diff line change 40
40
s1 =fn1.readlines()
41
41
print(s1)
42
42
"""
43
- #as list comp
43
+ #as list comp
44
44
45
45
print ([line .strip () for line in open ('demo2.txt' ,'r' )])
46
46
Original file line number Diff line number Diff line change 1
- 1.Python is dynamically-typed and garbage-collected
2
- 2.It supports multiple programming paradigms
3
- 3.Object-oriented and functional programming
1
+ Python is dynamically-typed and garbage-collected
2
+ It supports multiple programming paradigms
3
+ Object-oriented and functional programming
4
+ Python is dynamically-typed and garbage-collected
5
+ It supports multiple programming paradigms
6
+ Object-oriented and functional programming
7
+ Python is dynamically-typed and garbage-collected
8
+ It supports multiple programming paradigms
9
+ Object-oriented and functional programming
Original file line number Diff line number Diff line change
1
+ 1
2
+ 2
3
+ 3
4
+ 4
5
+ 5
6
+ 6
Original file line number Diff line number Diff line change
1
+ 1
2
+ 3
3
+ 5
You can’t perform that action at this time.
0 commit comments