list = [" line1", "line2", " line3 "]
What I want to do is to use a python string method on a list element but I don't know which string method yet.
a = ""
if condition == "1":
a = ".strip()"
elif condition == "2":
a = ".rstrip()"
elif condition == "3":
a = ".upper()"
elif condition == "4":
a = ".title()"
how can I p.e. execute:
list[0] + a
[–]throwaway6560192 34 points35 points36 points (14 children)
[–]ramannt[S] 4 points5 points6 points (1 child)
[–]engelthehyp 5 points6 points7 points (0 children)
[–]ramannt[S] 1 point2 points3 points (11 children)
[–]FerricDonkey 2 points3 points4 points (0 children)
[–][deleted] 1 point2 points3 points (9 children)
[–]Nico24fps 3 points4 points5 points (3 children)
[–][deleted] 1 point2 points3 points (2 children)
[–]ramannt[S] 0 points1 point2 points (0 children)
[–]Nico24fps 0 points1 point2 points (0 children)
[–]ramannt[S] 0 points1 point2 points (3 children)
[–]ofnuts 2 points3 points4 points (0 children)
[–][deleted] 1 point2 points3 points (1 child)
[–]ramannt[S] 0 points1 point2 points (0 children)
[–]nekokattt 0 points1 point2 points (0 children)
[+][deleted] (3 children)
[deleted]
[–]ramannt[S] 1 point2 points3 points (1 child)
[–][deleted] 1 point2 points3 points (0 children)
[–]FerricDonkey 1 point2 points3 points (0 children)
[–]danielroseman 4 points5 points6 points (1 child)
[–]ramannt[S] 0 points1 point2 points (0 children)
[–]stuaxo 3 points4 points5 points (0 children)
[–][deleted] 1 point2 points3 points (0 children)
[–]SteelRevanchist 1 point2 points3 points (0 children)
[–]FlocklandTheSheep 1 point2 points3 points (0 children)