If item in list = true, Output = xx - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: If item in list = true, Output = xx (/thread-24550.html) |
If item in list = true, Output = xx - kroh - Feb-19-2020 Hi all! I am totally new to Python, i hope i can learn one day... I am currently Working with Revit Architecture and Dynamo (Visual Programming). And I need with a Python Script. I am reading a large xlsx file into Dynamo, and i am reading it by Categories, f.e (walls, floors, roofs, windows, doors, etc..) The xlsx is in Swedsih, and has to be translated to English. So currently I have a big list with something like string == ["yttervägg", "innervägg"] Output = "Walls". My problem is, IF the string != my list 100%, i get 0 output. I need something like, "if" whatever the Input is as a [string], if the item exists in my translated list, it get's outputet by my translation (f.e yttervägg = walls)! As I said, im new to Python so i might've explained this poorly, but I need something like "if item exist in list" it gets output, same if several items exists, the output is in [] I just need an example on how to type it. Ty so much for your time! /Kristoffer |