看到“?”在创建新目录的末尾

时间:2018-10-04 14:21:14

标签: python python-2.7

## Heading ##
import os
num = raw_input("enter number of files : ")
name = raw_input( "enter name of the file : ")

print(num)
print(name)
print type(num)
print(name + "_" + num)
k = int(num)
print type(k)
k = k+1
x=open("firstnight.txt", "w")
for i in range(1,k):
    #print(name + "_" + str(i))
    x=open("firstnight.txt", "a")
    x.write(name + "_" + str(i))
    x.write('\n')
x.close()
q=open("firstnight.txt","r")
for p in q:
    print(p)
    os.mkdir(p)
q.close()

输出:

drwxr-xr-x    2 root     staff         64 Oct  4 13:35 love_1?

drwxr-xr-x    2 root     staff         64 Oct  4 13:35 love_2?

drwxr-xr-x    2 root     staff         64 Oct  4 13:35 love_3?

0 个答案:

没有答案