4 读取用户指令

1.语法

python 复制代码
input()  

2.示例

python 复制代码
#要求手动输入信息,打印信息卡  
Please input your name:xxx  
Please input your age:xxx  
Your hobbie:xxx  
  
----------xxx info----------  
name:xxx  
age:xxx  
hobbie:xxx  
-------------end-------------  
  
  
#实现代码  
name = input("Please input your name:")  
age = input("Please input your age:")  
hobbie = input("Your hobbie:")  
  
msg = f'''  
----------{name} info----------  
name:{name}  
age:{age}  
hobbie:{hobbie}  
-------------end-------------  
'''  
print(msg)  
相关推荐
lifewange12 分钟前
pytest-类中测试方法、多文件批量执行
开发语言·python·pytest
pluvium2734 分钟前
记对 xonsh shell 的使用, 脚本编写, 迁移及调优
linux·python·shell·xonsh
2401_827499991 小时前
python项目实战09-AI智能伴侣(ai_partner_5-6)
开发语言·python
PD我是你的真爱粉1 小时前
MCP 协议详解:从架构、工作流到 Python 技术栈落地
开发语言·python·架构
ZhengEnCi1 小时前
P2G-Python字符串方法完全指南-split、join、strip、replace的Python编程利器
python
是小蟹呀^1 小时前
【总结】LangChain中工具的使用
python·langchain·agent·tool
宝贝儿好1 小时前
【LLM】第二章:文本表示:词袋模型、小案例:基于文本的推荐系统(酒店推荐)
人工智能·python·深度学习·神经网络·自然语言处理·机器人·语音识别
王夏奇2 小时前
pythonUI界面弹窗设置的几种办法
python·ui
ZhengEnCi2 小时前
P2B-Python可迭代对象完全指南-从列表到生成器的Python编程利器
python
萌萌站起2 小时前
Vscode 中 python模块的导入问题
ide·vscode·python