Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import ftplib
- import re
- # open ftp connection
- ftp = ftplib.FTP(host='ftp.jbimporters.com', user='****', passwd='****')
- ftp.cwd('/')
- # get inv_loc file
- gFile = open("inv_loc.txt", "wb")
- ftp.retrbinary("RETR inv_loc.txt", gFile.write)
- gFile.close()
- ftp.quit()
- # get user input
- print("\nEnter JBI PN: ")
- partNumber = input()
- result = []
- shit = re.compile(partNumber)
- with open ("inv_loc.txt", 'rt') as myFile:
- for line in myFile:
- if shit.search(line) != None:
- result.append(line.split())
- break
- print(result)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement