Se rendre au contenu
Menu
Cette question a été signalée
5280 Vues

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
Ignorer
Publications associées Réponses Vues Activité
0
sept. 17
3551
1
janv. 23
6213
1
mars 21
18799
1
mars 15
4278
6
sept. 22
67048