码迷,mamicode.com
首页 > 编程语言 > 详细

Python 从sketch中读取文件

时间:2015-09-22 14:18:48      阅读:188      评论:0      收藏:0      [点我收藏+]

标签:

=============================== 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()
>>> 

 

Python 从sketch中读取文件

标签:

原文地址:http://www.cnblogs.com/oskb/p/4828700.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!