Advertisement
igort91

inventario

Nov 29th, 2011
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.55 KB | None | 0 0
  1. def existe_producto(codigo):
  2.     inventario=open("productos.txt")
  3.     for producto in inventario:
  4.         codigoz=(producto.strip().split("/"))[0]
  5.         if codigoz==str(codigo):
  6.             inventario.close()
  7.             return True
  8.     inventario.close()
  9.     return False
  10.  
  11.  
  12. def por_reabastecer():
  13.     stock=open("por_reabastecer.txt","w")
  14.     inventario=open("productos.txt")
  15.     for producto in inventario:
  16.         if int(producto.strip().split("/")[2])<10:
  17.             stock.write(producto)
  18.     stock.close()
  19.     inventario.close()
  20.  
  21. print por_reabastecer()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement