Removing character in list of strings

前端 未结 6 2158
清歌不尽
清歌不尽 2020-12-01 06:51

If I have a list of strings such as:

[(\"aaaa8\"),(\"bb8\"),(\"ccc8\"),(\"ffffdffffd8\")...]

What should I do in order to get rid of all the

6条回答
  •  孤城傲影
    2020-12-01 06:58

    Beside using loop and for comprehension, you could also use map

    lst = [("aaaa8"),("bb8"),("ccc8"),("ffffdffffd8")]
    mylst = map(lambda each:each.strip("8"), lst)
    print mylst
    

提交回复
热议问题