Chinaunix首页 | 论坛 | 博客
  • 博客访问: 235896
  • 博文数量: 49
  • 博客积分: 246
  • 博客等级: 二等列兵
  • 技术积分: 1034
  • 用 户 组: 普通用户
  • 注册时间: 2012-04-02 13:18
文章分类

全部博文(49)

分类: 系统运维

2014-07-22 18:49:31


#!/usr/bin/env python
# -*- coding: utf-8 -*-

import time

  1. class Readfile(object):
  2.         '''读取/etc/passwd一行一行读取'''
  3.         def file(chef):
  4.                 file = open('/etc/passwd')
  5.                 c = file.readlines()
  6.                 num = 1
  7.                 for i in c:
  8.                         print num,i.strip()
  9.                         num = num + 1
  10.                         time.sleep(1)
  11.                 print 'read done
  12. if  __name__=='__main__':
  13.     f = Readfile()
  14.     f.file()

阅读(1713) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~