Product Price

Script to edit prices for products.


In [1]:
import os

In [4]:
prodir = ('/home/wcmckee/sellcoffee/products/')

In [5]:
print os.listdir(prodir)


['debian', 'internet', 'python', 'hat', 'pepsi', 'fedora', 'coke', 'chips']

In [6]:
pricewhat = raw_input('Product to set price: ')


Product to set price: hat

In [7]:
priceset = raw_input('Price to set: ')


Price to set: 25.35

In [8]:
fpathz = (prodir + pricewhat + '/' + pricewhat + '-price')

In [10]:
wrpric = open(fpathz, 'w')

In [11]:
wrpric.write(priceset)

In [12]:
wrpric.close()

In [14]:
rdpric = open(fpathz, 'r')

print rdpric.read()

rdpric.close()


25.35

In [ ]: