質問編集履歴
2
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
intとstrが
|
1
|
+
intとstrが混合する行の結合と操作
|
test
CHANGED
File without changes
|
1
手違いがあり、異なるスクリプトを記載しておりました。もうしわけありません。実際のスクリプトに修正いたしました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -20,7 +20,7 @@
|
|
20
20
|
|
21
21
|
|
22
22
|
|
23
|
-
list'''
|
23
|
+
list_file.txt'''
|
24
24
|
|
25
25
|
TTTTCTC 2219
|
26
26
|
|
@@ -38,7 +38,7 @@
|
|
38
38
|
|
39
39
|
|
40
40
|
|
41
|
-
data'''
|
41
|
+
data_file.txt'''
|
42
42
|
|
43
43
|
TTTTCTC 40
|
44
44
|
|
@@ -84,43 +84,37 @@
|
|
84
84
|
|
85
85
|
```
|
86
86
|
|
87
|
-
#!/usr/bin/env python3
|
88
|
-
|
89
|
-
# coding: UTF-8
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
list= []
|
87
|
+
list = []
|
94
88
|
|
95
89
|
data = []
|
96
90
|
|
97
91
|
|
98
92
|
|
99
|
-
with open(list, 'r') as c:
|
93
|
+
with open('list_file.txt', 'r') as c:
|
100
94
|
|
101
95
|
for line in c:
|
102
96
|
|
103
97
|
if type(line) == str:
|
104
98
|
|
105
|
-
|
99
|
+
list.append(int(line.split()))
|
106
100
|
|
107
101
|
else:
|
108
102
|
|
109
|
-
|
103
|
+
list.append(line.split())
|
110
104
|
|
111
105
|
|
112
106
|
|
113
|
-
with open(data, 'r') as f:
|
107
|
+
with open('data_file.txt', 'r') as f:
|
114
108
|
|
115
109
|
for line in f:
|
116
110
|
|
117
111
|
if type(line) == str:
|
118
112
|
|
119
|
-
|
113
|
+
data.append(int(line.split()))
|
120
114
|
|
121
115
|
else:
|
122
116
|
|
123
|
-
|
117
|
+
data.append(line.split())
|
124
118
|
|
125
119
|
|
126
120
|
|
@@ -138,29 +132,29 @@
|
|
138
132
|
|
139
133
|
print(c[0],"\t",c[1],"\t", 0 )
|
140
134
|
|
141
|
-
|
142
|
-
|
143
135
|
```
|
144
136
|
|
145
137
|
エラー
|
146
138
|
|
139
|
+
---------------------------------------------------------------------------
|
140
|
+
|
147
141
|
TypeError Traceback (most recent call last)
|
148
142
|
|
149
|
-
<ipython-input-4
|
143
|
+
<ipython-input-48-553a02782dd4> in <module>
|
150
144
|
|
151
|
-
|
145
|
+
9 for line in c:
|
152
146
|
|
153
|
-
1
|
147
|
+
10 if type(line) == str:
|
154
148
|
|
155
|
-
---> 1
|
149
|
+
---> 11 list.append(int(line.split()))
|
156
150
|
|
157
|
-
1
|
151
|
+
12 else:
|
158
152
|
|
159
|
-
1
|
153
|
+
13 list.append(line.split())
|
160
154
|
|
161
155
|
|
162
156
|
|
163
|
-
TypeError: int() argument must be a string
|
157
|
+
TypeError: int() argument must be a string, a bytes-like object or a number, not 'list'
|
164
158
|
|
165
159
|
|
166
160
|
|