如何在python中向后打印列表中的每个字符串

如何在python中向后打印列表中的每个字符串,python,Python,如果我有一个字符串列表,比如 a=[“苹果”、“香蕉”、“橘子”] 我将如何反转列表中的每个字符串以使 a=['elppa','ananab','egnaro']这是如何: a = [y[::-1] for y in a] print(a) # ['elppa', 'ananab', 'egnaro'] 请花些时间阅读有关如何反转单个字符串 word = 'apple' print(word[::-1]) 所以 [x[:-1]对于a中的x]这看起来像是家庭作业。你自己试过什么吗?@Jean

如果我有一个字符串列表,比如

a=[“苹果”、“香蕉”、“橘子”]

我将如何反转列表中的每个字符串以使

a=['elppa','ananab','egnaro']

这是如何:

a = [y[::-1] for y in a]
print(a)  # ['elppa', 'ananab', 'egnaro']

请花些时间阅读有关

如何反转单个字符串

word = 'apple'
print(word[::-1])
所以


[x[:-1]对于a中的x]
这看起来像是家庭作业。你自己试过什么吗?@Jean-Françoisfar确实。谢谢
words = ['apple', 'banana', 'orange']
reversed_words = [word[::-1] for word in words]