回答編集履歴

1

変数名編集

2018/10/12 13:53

投稿

thinkn1108
thinkn1108

スコア45

test CHANGED
@@ -1,4 +1,6 @@
1
1
  これで動きますか?
2
+
3
+ (追記)変数間違っていたので変更しました
2
4
 
3
5
 
4
6
 
@@ -18,14 +20,14 @@
18
20
 
19
21
  for line in f:
20
22
 
21
- cookie = re.search(r'(?<=cookie=)[^&]*', col)
23
+ cookie = re.search(r'(?<=cookie=)[^&]*', line)
22
24
 
23
- prod = re.search(r'(?<=prod=)[^&]*', col)
25
+ prod = re.search(r'(?<=prod=)[^&]*', line)
24
26
 
25
27
  if cookie and prod:
26
28
 
27
29
  with open("output.csv", "a",newline='') as file:
28
30
 
29
- print("{},{}".format(cookie, prod), file=file)
31
+ print("{},{}".format(cookie.group(0), prod.group(0)), file=file)
30
32
 
31
33
  ```