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)  
相关推荐
kyle~10 小时前
FastAPI --- 将业务能力以 API 的形式提供给外部系统
python·fastapi·前后端
aiotto资源分享11 小时前
Python 写 JSON 文件,程序中途退出会留下什么?
java·python·json·jsondecodeerror
梯度下降者12 小时前
Python信号量,条件变量,事件学习
python·条件变量·事件·信号量·线程通信
MSTcheng.12 小时前
【AI应用实战】用 FastAPI + SSE 做一个自己的 AI 聊天网页:流式输出、多轮对话与完整源码
人工智能·python·大模型·fastapi·sse·ai聊天助手
the局外人13 小时前
Python 实战检索优化:BM25、向量与重排
数据库·后端·python
__underline__13 小时前
冷门Python知识点006篇:Python 类体里的名字,能被"凭空造出来"
后端·python
用户03321266636714 小时前
使用 Python 轻松移除 Excel 文档中的重复行
python·excel
LiaoWL12314 小时前
从零搭一个 RAG 知识库(二):换上语义 Embedding——BGE 实测与阈值重校准
python·大模型·numpy·embedding·向量检索·rag
Dmz丶14 小时前
前端转 AI 100 天 Day 48:向量数据库——100 万向量的毫秒级检索
python
青少儿编程课堂14 小时前
蓝桥杯·全国青少年信息素养大赛·电子学会Python/C++考级:中国剩余定理解析
c++·python·算法·bfs·信息学竞赛