質問編集履歴

2

配列の修正

2017/12/12 08:28

投稿

bellsmarket
bellsmarket

スコア62

test CHANGED
File without changes
test CHANGED
@@ -14,7 +14,7 @@
14
14
 
15
15
  例えば下記のような整形です。
16
16
 
17
- animal = ['21:34','0','Cat','21:34','0','Bird','21:33','84','Dog']
17
+ animals = ['21:34','0','Cat','21:34','0','Bird','21:33','84','Dog']
18
18
 
19
19
  21:34,0,Cat,
20
20
 
@@ -50,13 +50,15 @@
50
50
 
51
51
 
52
52
 
53
+ animals = ['21:34','0','Cat','21:34','0','Bird','21:33','84','Dog']
54
+
53
55
  listData = []
54
56
 
55
57
  for animal in animals :
56
58
 
57
59
  num += 1
58
60
 
59
- animal = animal.string #HTMLタグを除去
61
+ # animal = animal.string #HTMLタグを除去
60
62
 
61
63
  animal = animal.strip()
62
64
 

1

変数の説明

2017/12/12 08:28

投稿

bellsmarket
bellsmarket

スコア62

test CHANGED
File without changes
test CHANGED
@@ -68,7 +68,7 @@
68
68
 
69
69
  def make_csv() : #CSVファイルの作成
70
70
 
71
- dataFile = csv.writer(open(F'{path}animal.csv', 'w'))
71
+ dataFile = csv.writer(open(F'{path}animal.csv', 'w')) # 変数pathには保存先のディレクトリを入れています。
72
72
 
73
73
  dataFile.writerow(listData)
74
74