Home  >  Article  >  Backend Development  >  Python syntax exercises--user interaction

Python syntax exercises--user interaction

黄舟
黄舟Original
2016-12-28 17:28:191072browse

#!/usr/bin/env python
# -*- coding:utf8 -*-
name = input("请输入您的名字:")
print (name)
----------------------------------------------
Python 2.0 Python 3.0
input == eval
raw_input == input
------------------------------------

input: Type conversion will be done based on the user's input. raw_input: The user's input will be processed as a string. Example:
If you enter "57 + 3": input will get the integer 60raw_input will Get the string "57 + 3"

The above is the Python grammar exercise-the content of user interaction. For more related content, please pay attention to the PHP Chinese website (www.php.cn)!


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn