Dec-31-2019, 03:10 AM
I Suppose I d0nt know where to start with this kind of code.
I have built a part of script that asks the user to enter a number then return the row of that number within the csv file. I would like to put in the option for input to either search for a particular number and return the informaiton, or search for a range and return all numbers that are not included.
the code I have for the searching of a single number is
Im assuming to being my search of number not contained in the csv file, I would need to define a range, create a loop to search each number in the range and return if NOT in matching csv.
I have built a part of script that asks the user to enter a number then return the row of that number within the csv file. I would like to put in the option for input to either search for a particular number and return the informaiton, or search for a range and return all numbers that are not included.
the code I have for the searching of a single number is
import csv import codecs # Open using dictReader with open('AssignedLineURI.csv', 'rt') as AssignedLineURI: # Open file in UTF Codec csv_data = csv.DictReader(codecs.open('AssignedLineURI.csv', 'rU', 'utf-16', ),delimiter =';') # Input # Get Number in 10 digit format from input csenteredNumber = input("Enter User's Line Number in E164 Format: ") csLineURI = "tel:" + csenteredNumber + ";ext=" + csenteredNumber[-5:] # print(csLineURI) # Match Line URI to User for row in csv_data: if row['LineURI'] == csLineURI: print (row['DisplayName'] + " - " + row['SipAddress'] + " - " + row['DID'])This will prompt input for a telephone number, search the csv, and return the fields specified in the row.
Im assuming to being my search of number not contained in the csv file, I would need to define a range, create a loop to search each number in the range and return if NOT in matching csv.