######################################
#把文件每行的tab键分隔符改成逗号分隔符   #
######################################

from smtplib import  SMTP as smtp
from time import sleep
import linecache

startLine = 1
endLine   = 517
i=startLine
#read file content
try:
##    fobj=open("renren_45w.txt.txt",'r')
    fok=open('163_ok.txt','a+')
except IOError,e:
    print "open error",e

try:    
    while(i>=startLine and i<=endLine):
        try:
            line = linecache.getline("163.txt",i)
            if len(line.strip())>0:                
##                print line,'len:',len(line)
                line=line.replace("\t\n","\n").replace("\t",",")
                fok.write(line)                                       
                i=i+1
        except Exception,e:
            print e           
##            continue   
except Exception,e:
    print e        
         
fok.close()
print('Down')

   

  

相关文章:

  • 2021-06-16
  • 2021-08-04
  • 2021-09-03
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-11-21
  • 2022-12-23
  • 2022-12-23
  • 2021-09-09
  • 2022-12-23
  • 2021-07-13
相关资源
相似解决方案