ex18.py
ex19.py
Can give function straight numbers, variable, math, combine math and variable.
ex20.py
ex20_test.py
1、current_file = open(input_file),print current_file
2、f.seek(0), 使文件指针回到文件头。"moves the file to the 0 byte (first byte) in the file"
3、f.read(), 读取全部文档,文件指针到最后。
4、f.readline(), 读取文件的一行,每次使用得到新的一行。"reading a line from the file and moving the read head to right after the \n that ends that line."
5、打印f.readline(), 行与行之间有空格。
原因: “The readline() function returns the\n thats in the file at the end of that line.”
解决办法: ”Add a end = "" at the end of“of your print function calls to avoid adding double \n to every line ”
ex21.py