I have below code :
def pStockName():
global StockList
selfP = []
StockList = str(raw_input('Enter pipe separated list of StockS : ')).upper().strip()
items = StockList.split("|")
count = len(items)
print 'Total Distinct Stock Count : ', count
items = list(set(StockList.split("|")))
pipelst = [i.replace('-mc','').replace('-MC','').replace('$','').replace('^','') for i in items]
filepath = '/location/Stock_Data.txt'
f = open(filepath, 'r')
for lns in f:
split_pipe = lns.split(':', 1)
if split_pipe[0] in pipelst:
pipelst.remove(split_pipe[0])
for lns in pipelst:
print bcolors.red + lns,' is wrong Stock Name' + bcolors.ENDC
f.close()
when I execute above code it asks me to give some input as below :
Enter pipe separated list of StockS : aaa|aaa|hma
Total Distinct Stock Count : 3
Stocks Belonging to other Centers :
Stock Count From Other Center = 0
Stocks Belonging to Current Centers :
Active Stocks in US1 :
^AAA$|^AAA$|^HMA$
Ignored Stock Count From Current Center = 0
You Have Entered StockList belonging to this Center as: ^AAA$|^AAA$|^HMA$
Active Stock Count : 3
Do you wish to continue with these StockS [YES|Y|NO|N] : Y
You are seeing above when I give input (aaa|aaa|hma) and press enter its taking the duplicate entry "aaa" . I want to ignore this duplicate entry when I give the input and press enter. I would like to let you know this input can be as (aaa|AAA) or (AAA|AAA) or (aaa|aaa). Any how any duplicate entry I want to ignore irrespective of upper or lower case.
Please let me know what wrong I did here any how can I fix this.