input一行多个输入

input一行多个输入

a,b,c = input('请输入:').split(' ')

输入:1 2 3

a,b,c = input('请输入:').split(',')

输入:1,2,3
使用split()可以定义输入的数据以什么分割

使用map函数可以定义数据类型,如

a,b,c = map(float,input('请输入:').split(','))

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/qq_37287621/article/details/83014409