How can I convert a for loop in Powershell script to python code?
Power shell script
$result = Foreach ($row in $csv)
{ $row
if ($row.Param_Name -eq "p_s3bucket_arn") { $row.Param_Value = $S3Bucketarn }
}
Python Code:
with open('C:/test.csv') as csvfile:
readCSV = csv.reader(csvfile, delimiter=',')
for row in readCSV:
if(row[0]=='p_instance_count'):
row[1]=len(instance_count) # expecting to write in csv file as p_instance_count,10
Error while Executing Python Code:
if(row[0]=='p_instance_count'):
IndexError: list index out of range
CSV
Param_Name,Param_Value
p_instance_count,
p_tag_name,tag123