替代在ftp服务器上查找文件?

时间:2017-04-16 14:54:01

标签: python list python-3.5 openpyxl ftplib

所以我有一个非常粗略的方法来在ftp上找到特定的jpgs。 它在我拥有的excel上找到文件并检查ftp。 你们怎么会更快/更容易/更普遍地使这个更正确?

ftp = FTP("ftp.helmethouse.com")
g=ftp.login(user ='username',passwd = 'password')

wb = openpyxl.load_workbook(r'C:\Users\aaron\Documents\HustleHardRacing\Shoei HJC Colors only.xlsx')
sheet = wb.get_sheet_by_name('Shoei HJC full colors and sizes')

def check_line_for_img(line):
    for i in range(2,143):
        x = sheet.cell(row =i, column = 3).value
        k = ['r.jpg', 'top.jpg', 't.jpg', 'rer.jpg', 'rt.jpg']
        line = line[56:]
        if x is None:
            pass
        else:
            for i in range(len(k)):
                y = (x[:-2]+'03'+k[i])
                print(y)
                if line == y:
                    print(line)
                elif y is None:
                    print ('Error!')
                    pass
                else:
                    pass
k = ftp.retrlines('LIST', check_line)

1 个答案:

答案 0 :(得分:0)

您可以使用.data message: .asciiz "Hello\n" .text main: li $t1,0 la $t0,message loop: lb $a0,0($t0) beqz $a0,done addi $t0,$t0,1 addi $t1,$t1,1 j loop done: li $v0,1 add $a0, $0,$t1 syscall li $v0,10 syscall 执行此操作,例如:

set()
  

<强>输出
  x = ['r01','top01','t01','rer01','rt01']
  x_set = {'top','r','rer','t','rt'}
  k_set = {'top','rer','t','r','rt','rr'}
  x_set缺失:{'rr'}
  k_set缺少无

使用Python测试:3.4.2 - openpyxl:2.4.1