Hi. How do i code in python an else/if statement where i can find in another field parts of a string.
example complete string :
if (A == "ABE"): return "abek"
example looking for part ( not working)
if [A] <> "G": return "gbk"
You want the 'in' operator, it will check to see if an element is in an iterable… and strings are iterables
'A' in 'ABC'True'A' in 'DEF'False
See the plenty of python pages on slicing strings and list, and the use of indexes.
>>> A = "ABCD">>> A'A'>>> A[-1]'D'>>> A[1:2]'B'>>> A[1:3]'BC'>>>
If either Dan's or Neil's comment addressed your question, please mark one of them "Correct" to close out the question.
Retrieving data ...