Input
x = raw_input()
y = raw_input("Name?")
#这句话会用 “Name?” 提示用户
z = raw_input("> ")
Import
from sys import argv
script, first, second, third = argv
print "The script is called:", script
print "Your first variable is:", first
print "Your second variable is:", second
print "Your third variable is:", third
Read and Write file
txt = open("d:\text.txt")
#txt = open("d:\text.txt", 'w')
print txt.read()
txt.close()
close – 关闭文件。
read – 读取文件内容。你可以把结果赋给一个变量。
readline – 读取文本文件中的一行。
truncate – 清空文件,请小心使用该命令。
write(stuff) – 将stuff写入文件。