01/10/2018, 13:45

Chương trình nhập ký tự trong python có vấn đề

E đang làm ct python nhập ký tự rồi in ra ký tự đứng sau nó (nhập a thì in ra b), mà sao chạy thì nó báo ntn các bác?

E thử đổi sang list rồi mà vẫn bj vậy

Quân viết 15:49 ngày 01/10/2018

Python 2:

raw_input() takes exactly what the user typed and passes it back as a string.

input() first takes the raw_input() and then performs an eval() on it as well.

The main difference is that input() expects a syntactically correct python statement where raw_input() does not.
Python 3:

raw_input() was renamed to input() so now input() returns the exact string.
Old input() was removed.

If you want to use the old input(), meaning you need to evaluate a user input as a python statement, you have to do it manually by using eval(input()).

chắc bạn đang dùng python 2, nên nếu chỉ muốn lấy input thông thường thì nên dùng raw_input thay vì input

vu van thinh viết 15:45 ngày 01/10/2018

hình như là phải ép kiểu cho a với b

Bài liên quan
0