Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
5327 มุมมอง

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

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
0
ก.ย. 17
3582
1
ม.ค. 23
6269
Import py file of a custom module แก้ไขแล้ว
1
มี.ค. 21
18868
1
มี.ค. 15
4300
Press a button and download a file, how? แก้ไขแล้ว
6
ก.ย. 22
67146