摘要:        
Python中使用标准库中的linecache中的getline方法可以从某个文件中读取出特定的一行。比如:Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--importlinecacheprintlinecache.getline('2.1_open....    阅读全文
        
            posted @ 2008-05-10 21:52
CoderZh
阅读(11677)
评论(0)
推荐(0)
        
        
            
        
        
摘要:        
Python中文件操作可以通过open函数,这的确很像C语言中的fopen。通过open函数获取一个file object,然后调用read(),write()等方法对文件进行读写操作。1.open使用open打开文件后一定要记得调用文件对象的close()方法。比如可以用try/finally语句来确保最后能关闭文件。Code highlighting produced by Actipro C...    阅读全文
        
            posted @ 2008-05-10 17:32
CoderZh
阅读(5984)
评论(5)
推荐(0)
        
        
 
                    
                     
                    
                 
                    
                 
         浙公网安备 33010602011771号
浙公网安备 33010602011771号