Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
4
Task/Create-a-file/Python/create-a-file-1.py
Normal file
4
Task/Create-a-file/Python/create-a-file-1.py
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
import os
|
||||
for directory in ['/', './']:
|
||||
open(directory + 'output.txt', 'w').close() # create /output.txt, then ./output.txt
|
||||
os.mkdir(directory + 'docs') # create directory /docs, then ./docs
|
||||
9
Task/Create-a-file/Python/create-a-file-2.py
Normal file
9
Task/Create-a-file/Python/create-a-file-2.py
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
from __future__ import with_statement
|
||||
import os
|
||||
def create(directory):
|
||||
with open(os.path.join(directory, "output.txt"), "w"):
|
||||
pass
|
||||
os.mkdir(os.path.join(directory, "docs"))
|
||||
|
||||
create(".") # current directory
|
||||
create("/") # root directory
|
||||
Loading…
Add table
Add a link
Reference in a new issue