We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
# -*- coding: utf-8 -*- from ftplib import FTP # 链接ftp ftp = FTP() # ftp.set_debuglevel(2) ftp.connect('ip', 21, 30) ftp.login('账号', '密码') ftp.cwd('/') print ftp.getwelcome() #打印出欢迎信息 #files = [] #获取目录信息 bufsize=1024 #设置的缓冲区大小 i=0 l=len(ftp.nlst('/')) print l while i < l: print ftp.nlst('/')[i] #遍历下载 # filename = ftp.nlst('/')[i] # file_handle=open(filename,"wb").write #以写模式在本地打开文件 # ftp.retrbinaly("RETR",file_handle,bufsize) #接收服务器上文件并写入本地文件 #处理下载数据,插入数据库 #删除ftp空间内容 i +=1 #ftp.retrlines('LIST', files.append) #print files # do something ftp.quit()
# -*- coding: utf-8 -*- #CHI|D|F2003310004|行吗|身份证号||0|2020-03-31|2020-04-03|0| # 将字符串转换成数组 # 原始数据是一条一个txt文本 fu = "CHI|D|F2003310004|行吗|身份证号||0|2020-03-31|2020-04-03|0|" arr = fu.split('|') # print arr #根据长度 print len(arr) for i in arr: print i # 将数组遍历插入数据库 # 10个数据为一条,最后一个空白删除掉
The text was updated successfully, but these errors were encountered:
No branches or pull requests
The text was updated successfully, but these errors were encountered: