質問編集履歴

2

エラーの追加

2018/10/17 02:42

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -74,4 +74,38 @@
74
74
 
75
75
 
76
76
 
77
+ また
78
+
79
+ ```python
80
+
81
+ with open(path2) as f3:
82
+
83
+ next(f3)
84
+
85
+ for line3 in f3:
86
+
87
+ fileobj = open("line2_2.log","a")
88
+
89
+ print(line3.strip("\n"), file=fileobj)
90
+
91
+
92
+
93
+ ```
94
+
95
+ としたところ、
96
+
97
+ ```python
98
+
99
+ print(line3.strip("\n"), file=fileobj)
100
+
101
+ ^
102
+
103
+ SyntaxError: invalid syntax
104
+
105
+
106
+
107
+ ```
108
+
109
+ というエラーが出ました。
110
+
77
111
  よろしくお願いします。

1

コードブロックにいれ、間違っている箇所を編集しました。

2018/10/17 02:42

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -12,7 +12,7 @@
12
12
 
13
13
  aaa.txtの2行目から出力するために
14
14
 
15
-
15
+ ```python
16
16
 
17
17
  path2 = 'aaa.txt'
18
18
 
@@ -25,6 +25,10 @@
25
25
  for line3 in f3:
26
26
 
27
27
  print(line3.strip("\n"))
28
+
29
+
30
+
31
+ ```
28
32
 
29
33
 
30
34
 
@@ -46,6 +50,8 @@
46
50
 
47
51
 
48
52
 
53
+ ```python
54
+
49
55
  with open(path2) as f3:
50
56
 
51
57
  next(f3)
@@ -54,7 +60,9 @@
54
60
 
55
61
       fileobj = open("line2_2.log","a")
56
62
 
57
- fileobj.write(line3.sprit("\n"))
63
+ fileobj.write(line3.strip("\n"))
64
+
65
+ ```
58
66
 
59
67
 
60
68