Python 从sketch中读取文件

=============================== RESTART: Shell ===============================
>>> import os
>>> os.getcwd()
'C:\Windows\System32'
>>> os.chdir('C:/Users/eric/Documents/Python')
>>> os.getcwd()
'C:\Users\eric\Documents\Python'
>>> data = open ('sketch.txt')
>>> print (data.readline(),end='')
Man: Is this the right room for an argument?
>>> print (data.readline(),end='')
Other Man: I've told you once.
>>> data.seek(0)
0
>>> for each_line in data:
	print(each_line, end='')

	
Man: Is this the right room for an argument?
Other Man: I've told you once.
Man: No you haven't!
Other Man: Yes I have.
Man: When?
Other Man: Just now.
Man: No you didn't!
Other Man: Yes I did!
Man: You didn't!
Other Man: I'm telling you, I did!
Man: You did not!
Other Man: Oh I'm sorry, is this a five minute argument, or the full half hour?
Man: Ah! (taking out his wallet and paying) Just the five minutes.
Other Man: Just the five minutes. Thank you.
Other Man: Anyway, I did.
Man: You most certainly did not!
Other Man: Now let's get one thing quite clear: I most definitely told you!
Man: Oh no you didn't!
Other Man: Oh yes I did!
Man: Oh no you didn't!
Other Man: Oh yes I did!
Man: Oh look, this isn't an argument!
(pause)
Other Man: Yes it is!
Man: No it isn't!
(pause)
Man: It's just contradiction!
Other Man: No it isn't!
Man: It IS!
Other Man: It is NOT!
Man: You just contradicted me!
Other Man: No I didn't!
Man: You DID!
Other Man: No no no!
Man: You did just then!
Other Man: Nonsense!
Man: (exasperated) Oh, this is futile!!
(pause)
Other Man: No it isn't!
Man: Yes it is!
>>> data.close()
>>> 
原文地址:https://www.cnblogs.com/oskb/p/4828700.html