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

質問編集履歴

1

情報の修正

2019/02/19 09:41

投稿

taiyo2017
taiyo2017

スコア170

title CHANGED
File without changes
body CHANGED
@@ -2,7 +2,7 @@
2
2
  ```ここに言語を入力
3
3
  b = BytesIO()
4
4
  with zipfile.ZipFile(b, 'r') as file:
5
- file.write("test.xml", "test.xml".read())
5
+ file.write("test", "aaa")
6
6
  ```
7
7
  のように書いたところ、
8
8
  zipfile.BadZipFile: File is not a zip file とエラーが出ました。変数bがzipではないからこのエラーが出るとは思うのですが、どう修正したらいいのかわかりません。