我正在尝试制作一个创建目录(名称输入)并在刚刚创建的输入文件夹中创建第二个目录的脚本。
import os
import sys
user_input = raw_input("Enter name: ")
user_input1 = raw_input('Enter case: ')
path = user_input
if not os.path.exists(path):
os.makedirs(path)
path = user_input1
if not os.path.exists(user_input/user_input1):
os.makedirs(path)
我明白了
if not os.path.exists(user_input/user_input1):
TypeError: unsupported operand type(s) for /: 'str' and 'str'
我在这里做错了什么?
我试过这样做:
if not os.path.exists('/user_input1/user_input'):
但这导致它创建了两个单独的目录而不是子目录