Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
5243 Zobrazení

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
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
0
zář 17
3520
1
led 23
6131
1
bře 21
18745
1
bře 15
4248
6
zář 22
66939