Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
5305 Lượt xem

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

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 9 17
3577
1
thg 1 23
6252
1
thg 3 21
18860
1
thg 3 15
4295
6
thg 9 22
67131