Sep-03-2023, 09:43 PM
(Sep-03-2023, 05:43 PM)Skaperen Wrote: you have code or you intend to have code. if you have learned enough you can at least try to make code. if you show us what you have tried (even if it immediately fails) we might get some idea of what you are thinking or what you need to change so it goes on to the next step.
i do not understand your description of what you are trying to do.
Ok, I will explain better
I have converted may csv file in a list with the code below
csv_file_path = '/Users/ecosta/Downloads/values.csv' with open(csv_file_path, 'r') as file: csv_reader = csv.reader(file) data_list = [] for row in csv_reader: data_list.append(row) for row in data_list: print(row)
The result is:
['nre', 'echoRequests']
['nrbrc', 'n3BearerResourceCommand']
['nrcn', 'n3ChangeNotificationRequest']
['nrrc', 'n3ContextRsp']
['nrcit', 'n3CreateIndirectDataFwdTunnel']
['nrcs', 'n3CreateSessRequest']
['nrdbc', 'n3DeleteBearerCommand']
['nrdit', 'n3DeleteIndirectDataFwdTunnel']
['nrds', 'n3DeleteSessRequest']
['nri', 'n3Identification']
in the @Larz60+ code we have the below:
def testit(): buf = "-nrrc 3 -trac 3 -nrds 2 -trds 5 -nrcs 2 -nrmb 2 -trmb 2 -nrrab 2 " \ "-trrab 1-nri 3 -tri 3 -nrfr 2 -trfr 7 -nfrc 2 -tfrc 1 -nfac 2 " \ "-tfac 1 -nrca 2 -trca 1 -nrdbc 2 -trdbc 4 -nrmbc 2 -trmbc 4 -era on " \ "-nre 5 -tre 120 -trsl 24 -nrcn 1 -trcn 4 -nrpc 2 -trpc 7 -tnsc 10 " \ "-nns 2 -tas 1 -nnr 2 -tar 1 -nnsc 2 -tasc 1 -pb off -sncr off " \ "-trer 1 -eras off -nres 3 -tres 3000 -eris 60 -trcs 5000 -eriss 60 " \ "-nress 3 -tress 3 -eram off -erim 60 -nrem 3 -trem 3 -trgl 1 " \ "-trcss 4000 -trdss 2 -trmbs 2 -trmbcs 4 -nrcss 2 -nrdss 3 -nrmbs 2 " \ "-nrmbcs 2 -mmbr off -mabr on -nrmab 2 -trmab 2 -trml 24 -nbsig on " \ "-rnccpe true -rnccsi true -dnd 0 -hfipe false -nrcit 2 -trcit 2 " \ "-nrdit 2 -trdit 2 -tdit 6 -tavac 2 -scn false -nrbrc 2 -nrbrcs 2 " \ "-trbrc 4000 -trbrcs 4000 -gpfcl 72,73,78,83,84,86,91,100,113,120 " \ "-rlm off -atrc 10 -sots off" newstring = replace_text(buf, replace_this='nrdbc', with_this='n3DeleteBearerCommand') print(newstring)I would like to use the csv converted in list to pass the first string in "replace_this" and the second string in "with_this"
I think I have explained better.
Thanks guys