Skip to Content
Menu
Dette spørgsmål er blevet anmeldt
5296 Visninger

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
Kassér
Related Posts Besvarelser Visninger Aktivitet
0
sep. 17
3575
1
jan. 23
6243
1
mar. 21
18855
1
mar. 15
4295
6
sep. 22
67119