2011-02-23 47 views
1
def creating_folder_for_csv_files(cwd): 
    try: 
     os.makedirs(cwd+'\\migration_data\\trade') 
    except os.error, e: 
     print "Could not create the destination folder for CSV files" 
    # end of first try/except block 

    try: 
     os.makedirs(cwd+'\\migration_data\\voucher') 
    except os.error, e: 
     print "Could not create the destination folder for CSV files" 

在我的代码中,第一个try/except块的作品,但第二个没有。有什么问题?多次尝试/除了在一个单一的功能不起作用

+6

请更具体地说明你的意思是'不'[work]?'预期的行为是什么,你看到的行为是什么? – phooji 2011-02-23 06:50:46

+0

当你说它不起作用时,你是什么意思?它不创建目录?它会抛出异常?都不是? – Gabe 2011-02-23 06:50:55

+1

值得一提的是,使用[os.path.join](http://docs.python.org/library/os.path.html#os.path.join)来加入一个或多个路径组件。 – Paolo 2011-03-13 14:29:16

回答

0

voucher可能已经存在。