Sorry if this question was answered elsewhere. Search through Google and Stackforum I did not find anything from which I could extrapolate the answers; but I feel that this is part of me.
I am trying to develop lambdas as a concept, and as part of this I was kind of looking for ways to use it.
SO, if this is a tremendously stupid deal with lambda in terms of function, feel free to let me know and explain. But anyway, I still want to know the answer / still want to know how to do this with the python language.
So, for testing purposes, I have:
my_test = 'test_name'
testlist = ['test_name', 'test_name_dup', 'test_name_dup_1', 'test_name_dup_3']
I want to use lambda to create a single function that scrolls and returns the first process_name that is not in the test list. The functionality will eventually be applied to the file names, but for testing purposes I had to get away from actually reading the file names - there were still too many ways to spoil something.
But my_test should be able to change, and the list of tests will be a list of file paths.
So I'm looking for a function like:
new_name = lambda x: my_test + '_' + str(x)
But the initial value should be x = 1, and it should continue until the new name is in the test list. It seems that:
bool(new_name not in testlist)
maybe something works.
But I cannot figure out how to set the initial x to 1 and skip it with (x + 1) until the bool is true.
, , CRAZY lambda, . ( , .
? ( , test_name, test_name_dup, test_name_dup _ #)?
! ( ) .