Created
June 5, 2015 17:57
-
-
Save adamv/3f67a16a605e11627bed to your computer and use it in GitHub Desktop.
Create and use a temporary file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3.4 | |
| import tempfile | |
| from subprocess import call | |
| with tempfile.NamedTemporaryFile() as f: | |
| for i in range(500): | |
| f.write(bytes("abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij\n", 'UTF-8')) | |
| f.flush() | |
| call(["cat", f.name]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment