<reponame>MKastuv/Data_Manipulation
#! /usr/bin/env python

#import csv module; dir(csv) will show all the variables/object and methods inside csv
import csv

with open("test.csv") as f: #it will open the file as f and close after its indentation.
    print("\n")
    print("This is how the row files looks like:\n")
    print(f.read())

# One thing to notice, if we dont use *with* we can use something like csv_open=open("test.csv") but after using it we needed to close using csv_open.close().
# Just like we cannot keep open our application or file otherwise it can be corrupted.

# We want to open the csv file and use reader() object inside csv module to print within a loop.
with open("test.csv") as f:
    csv_read=csv.reader(f)

    #{swicth} are called place-holders that can be used with built in function .format
    for row in csv_read:
        print("Switch Name: {switch} is located in {location} and has IP {ip}".format(
            switch = row[0],
            ip = row[2],
            location = row[1]
        ))
#! /usr/bin/env python

#import csv module; dir(csv) will show all the variables/object and methods inside csv
import csv

with open("test.csv") as f: #it will open the file as f and close after its indentation.
    print("\n")
    print("This is how the row files looks like:\n")
    print(f.read())

# One thing to notice, if we dont use *with* we can use something like csv_open=open("test.csv") but after using it we needed to close using csv_open.close().
# Just like we cannot keep open our application or file otherwise it can be corrupted.

# We want to open the csv file and use reader() object inside csv module to print within a loop.
with open("test.csv") as f:
    csv_read=csv.reader(f)

    #{swicth} are called place-holders that can be used with built in function .format
    for row in csv_read:
        print("Switch Name: {switch} is located in {location} and has IP {ip}".format(
            switch = row[0],
            ip = row[2],
            location = row[1]
        ))
#! /usr/bin/env python #import csv module; dir(csv) will show all the variables/object and methods inside csv #it will open the file as f and close after its indentation. # One thing to notice, if we dont use *with* we can use something like csv_open=open("test.csv") but after using it we needed to close using csv_open.close(). # Just like we cannot keep open our application or file otherwise it can be corrupted. # We want to open the csv file and use reader() object inside csv module to print within a loop. #{swicth} are called place-holders that can be used with built in function .format