Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'doc/python_api/examples/bpy.data.py')
-rw-r--r--doc/python_api/examples/bpy.data.py9
1 files changed, 3 insertions, 6 deletions
diff --git a/doc/python_api/examples/bpy.data.py b/doc/python_api/examples/bpy.data.py
index 7d6bf94532b..c06199d8af3 100644
--- a/doc/python_api/examples/bpy.data.py
+++ b/doc/python_api/examples/bpy.data.py
@@ -19,9 +19,6 @@ if "Cube" in bpy.data.meshes:
# write images into a file next to the blend
import os
-file = open(os.path.splitext(bpy.data.filepath)[0] + ".txt", 'w')
-
-for image in bpy.data.images:
- file.write("%s %d x %d\n" % (image.filepath, image.size[0], image.size[1]))
-
-file.close()
+with open(os.path.splitext(bpy.data.filepath)[0] + ".txt", 'w') as fs:
+ for image in bpy.data.images:
+ fs.write("%s %d x %d\n" % (image.filepath, image.size[0], image.size[1]))