01/10/2018, 00:58

Lesson 15 in learnpythonhardway

Hi Anh chị,
Em học tới bài 15, chạy công thức bị báo lỗi như zầy, em ko biết fix sao, anh chị giúp em, em làm y như hướng dẫn của anh Đạt
Code

from sys import argv

script, filename = argv

txt = open(filename)

print "Here's your file %r:" % filename
print txt.read()

print "Type the filename again:"
file_again = raw_input ("> ")

txt_again = open (file_again)

print txt_again.read()

–> result
PS C:UsersCPU11628-localpythondaynhauhoc> python .ex15more.py
Traceback (most recent call last):
File “.ex15more.py”, line 3, in
script, filename = argv
ValueError: need more than 1 value to unpack

Chu Mai Bình viết 03:09 ngày 01/10/2018

Lúc bạn gọi file Ex15.py ra để compile thì bạn nhập thiếu tham số thì phải

ngoc viết 03:11 ngày 01/10/2018

Cám ơn bạn, mình thiếu tham số của filename khi chạy

Bài liên quan
0