Yogwhatup
Yogwhatup

Reputation: 362

Simply create a file in a windows directory using Python

All I want to do is create a file (doesn't matter the extension) in a windows directory using Python.

I cannot find any reference to this specific function anywhere currently.

Upvotes: 0

Views: 98

Answers (2)

Russley Shaw
Russley Shaw

Reputation: 441

open(filename, "w") might be what you're looking for. The "w" argument means write and will create that file if it doesnt already exist. If it does exist, it will overwrite the contents if written to. Python I/O Documentation

Upvotes: 1

Chris
Chris

Reputation: 33

You would use write() for this, using a file name that you haven't used before.

http://www.tutorialspoint.com/python/file_write.htm

Upvotes: 1

Related Questions