Python中使用open BIF与文件交互,与for语句结合使用,一次读取一行 读取文件sketch.txt,文件内容如下: Man: Ah! (taking out his wallet and paying) Just the five minutes.Other Man: Just the five minutes. Thank you.Other Man: Now let's get one thing quite clear: I most definitely told you!M…
1: for 循环可以循环如下类型: my_string = "abcabc" // 字符串类型 for c in my_string: print(c, end=' ') cars = ['aa','bb','cc'] // list类型 for car in cars: print(car) d = {, } // 字典类型, for key in d: // 默认是key print(key + " " + str(d[key])) t = (1, 2, 3)…