Skip to Content
मेन्यू
This question has been flagged
5362 Views

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
Discard
Related Posts Replies Views Activity
0
सित॰ 17
3618
1
जन॰ 23
6328
1
मार्च 21
18899
1
मार्च 15
4350
6
सित॰ 22
67247