teratail header banner
teratail header banner
質問するログイン新規登録

回答編集履歴

1

修正

2020/12/27 16:52

投稿

退会済みユーザー
answer CHANGED
@@ -15,8 +15,7 @@
15
15
  ```
16
16
  async with aiohttp.ClientSession() as session:
17
17
  async with session.get(url='https://URL/file/data1.xml') as response:
18
- text = await response.text(encoding='Shift_JIS') #<------------修正
18
+ xml_data = await response.text(encoding='Shift_JIS') #<------------修正
19
- xml_data = text #<------------追加
20
19
  ```
21
20
 
22
21
  となります。
@@ -51,8 +50,7 @@
51
50
  async def e():
52
51
  async with aiohttp.ClientSession() as session:
53
52
  async with session.get(url='https://URL/file/data1.xml') as response:
54
- text = await response.text(encoding='Shift_JIS')
53
+ xml_data = await response.text(encoding="Shift_JIS")
55
- xml_data = text
56
54
  try:
57
55
  root = ET.fromstring(xml_data)
58
56
  for item in root.iter('item'):