I need to be able to find and change a value in a CSV stock file. I know how to search for a value but when I try to use the csv.writer then it returns an error.
Traceback (most recent call last):
File "\\pbsrvfile\ExamAccounts$\ITCA76\ochot_krystian_a453\Task 3\Task 3.pyw", line 8, in
for row in writer:
TypeError: '_csv.writer' object is not iterable
I have no idea why it is doing that. So far I have this for the code:
import csv
code=input('Enter code to search: ')
stock=open ('Stock Levels.csv', 'wb')
writer=csv.writer(stock)
for row in writer:
for field in row:
if field==code:
print('Record found! \n')
print('Code: '+row[0])
print('Product name: '+row[1])
print('Tar