python 等待输入指令(input)

在跑代码时,特别是跑数据,时常只是想选取其中某些个例,在源代码改起来很麻烦;这时,用户输入起到了极大便利。

# -*- coding: utf-8 -*-
"""
Created on Mon Apr 22 13:02:01 2019

@author: cz007
"""
import sys

print (sys.argv[0])
price = input("price:[eg, 10,20]\n")
a=price.split(',')
print(price)

结果
runfile(‘F:/test.py’, wdir=‘F:’)
F:/test.py

price:[eg, 10,20]
1,2
1,2

数据类型
在这里插入图片描述

你可能感兴趣的:(学习笔记)