cschuck320

FINALLY

Jun 18th, 2021
781
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import ftplib
  2. import re
  3.  
  4. # open ftp connection
  5. ftp = ftplib.FTP(host='ftp.jbimporters.com', user='****', passwd='****')
  6. ftp.cwd('/')
  7.  
  8. # get inv_loc file
  9. gFile = open("inv_loc.txt", "wb")
  10. ftp.retrbinary("RETR inv_loc.txt", gFile.write)
  11. gFile.close()
  12. ftp.quit()
  13.  
  14. # get user input
  15. print("\nEnter JBI PN: ")
  16. partNumber = input()
  17. result = []
  18. shit = re.compile(partNumber)
  19.  
  20. with open ("inv_loc.txt", 'rt') as myFile:
  21.     for line in myFile:
  22.         if shit.search(line) != None:
  23.             result.append(line.split())
  24.             break
  25.  
  26. print(result)
RAW Paste Data