Mình ko hiểu đoạn code này?

Mình đang học python nhưng lại ko hiểu đoạn này

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

ai giải thích dùm

Bạn không hiểu chỗ nào

Dòng cuối sai cú pháp.

Đây chỉ là 1 đoạn code đọc nội dung file thông thường. Bạn đọc lại cú pháp cơ bản về mở file, đọc dữ liệu từ file.

Mong @drgnz close topic.

This topic was automatically closed after 46 minutes. New replies are no longer allowed.

1 Like
83% thành viên diễn đàn không hỏi bài tập, còn bạn thì sao?