-3

I have the problem, that I am trying to run a function which has as input an array of strings and before making some if-statement I am lowering the strings. somehow i am receiving the error message

AttributeError: 'list' object has no attribute 'lower'

It is not clear for me why do I receive it. The funny part is, If I have both in one script it works. If I source the function out and load it into another script it does not work. The code looks like the following:

def Calc(String_Array1, String_Array2):
    String_Array1 = String_Array1.lower()
    String_Array2 = String_Array2.lower()

    if String_Array1 == "a":
        print(String_Array1)  
    elif String_Array2 == "b":
        print(String_Array2)
    else:
        raise Exception("Something went wrong")


    return 0

I am running then my own module like the following

import helper_module as hm

String_Array1 = ["A"]    
String_Array2 = ["B"]

test = hm.CalcFXFwdCurve(String_Array1,String_Array2)

print(test)
JonDoe
  • 107
  • 7

1 Answers1

0

So the solution works with an numpy array using char.lower(). The the if-statement can be performed using any() or all()

JonDoe
  • 107
  • 7