Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
5375 Tampilan

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')

Avatar
Buang
Post Terkait Replies Tampilan Aktivitas
0
Sep 17
3631
1
Jan 23
6352
1
Mar 21
18933
1
Mar 15
4354
6
Sep 22
67288