开发者

Adding Keyboard input to Directories [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.

Want to improve this question? Add details and clarify the problem by editing this post.

Closed 9 years ago.

Improve this question

I 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']
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜