コンテンツへスキップ
メニュー
この質問にフラグが付けられました
5380 ビュー

I got an error : OSError: [Errno 2] No such file or directory: '/Users/Downloads'

What is wrong in this code?


 import random, os
a = random.randint(1, 9999)
name = 'filename' + str(a * 7) + '.txt'
print '>>', a
ROOT = os.path.abspath(os.sep)
filepath = os.path.join(ROOT, name)
os.chdir(filepath)
file = open(filepath, 'w')

アバター
破棄
関連投稿 返信 ビュー 活動
0
9月 17
3648
1
1月 23
6369
1
3月 21
18944
1
3月 15
4357
6
9月 22
67303