标签:truncate 说明 移动 写入文件 获取 write script 其他 echo
格式: input("prompt")
功能:从 CLI 获取 User 的一个输入,显示 promt 的内容,并且返回一个 string 类型的数值
其他:如果想要读取 User 的输入进行数学运算,可以使用x= int(input())
,或者float(input())
脚本:程序
将模块引入脚本:from sys import argv
解包:script, first, second, third = argv
将 argv 中的东西取出,解包,将所有的参数依次赋值给左边的这些变量。
用法:echo "This is a test file.">test.txt
可以通过这个方法创建一个名字叫 test.txt,内容为“This is a test file"的文件。
用法:pydoc input
可以通过这个在命令行中查看 input 的介绍,按 q 结束查看。
learn the python the hard way习题11~17总结
标签:truncate 说明 移动 写入文件 获取 write script 其他 echo
原文地址:https://www.cnblogs.com/FBsharl/p/10158446.html