Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this questionI want to create a directory but I also want to add Keyboard input. Specifically, I want the user to chose the directory name, and location, and then it displays the name and location that the user entered.
Directory:
#!/usr/bin/pyth开发者_如何学编程on
import os
# Create a directory that the user choses when and where
os.mkdir()
Keyboard Input:
filename = raw_input('Filename:')
print('You Entered the Filename:'), filename
Figured it out!!!!!
Thanks everyone but I figured it out!
import os
filename = raw_input('Enter Filename:')
os.mkdir(filename)
print('Filename Entered'), filename
>>> import os
>>> os.curdir
'.'
>>> filename = raw_input('Filename:')
Filename:mydir
>>> os.mkdir(filename)
>>> os.listdir(os.curdir)
['mydir']
精彩评论