Python 按重要性顺序对输入进行排序

Python 按重要性顺序对输入进行排序,python,list,sorting,indexing,Python,List,Sorting,Indexing,我不是一个程序员,但了解python的基础知识。我希望我的用户输入一个随机列表,例如: Reuters The New York Times The Wall Street Journal Associated Press Financial Times 我的代码根据索引位置对其进行排序: outlet = [ 'The Wall Street Journal', 'The New York Times', 'Associated Press', 'Reuters', 'Financial T

我不是一个程序员,但了解python的基础知识。我希望我的用户输入一个随机列表,例如:

Reuters
The New York Times
The Wall Street Journal
Associated Press
Financial Times
我的代码根据索引位置对其进行排序:

outlet = [ 'The Wall Street Journal', 'The New York Times', 'Associated Press', 'Reuters', 'Financial Times', 'USA Today','Bloomberg','CNBC']
因此,它在新的行上打印有序的:

The Wall Street Journal 
The New York Times
Associated Press
Reuters
Financial Times
谢谢大家!

我目前掌握的守则如下:

 ranking = [ 'The Wall Street Journal', 'The New York Times', 'Associated Press', 'Reuters', 'Financial Times', 'USA Today','Bloomberg','CNBC']
print('Enter new coverage:')
coverage = input()
listed = coverage.split()
print(*listed, sep="\n")

好的,如果你有一个列表,
a=[路透社、纽约时报、华尔街日报、美联社、金融时报]
并且你想根据列表
排名对它进行排序,['华尔街日报'、'纽约时报'、'美联社'、'路透社'、'金融时报'、'今日美国'、'彭博'、'CNBC']
您可以通过迭代
排名
列表来完成,并查看列表
a
是否包含
排名
列表的第一个元素,如果包含第二个元素,依此类推。代码如下所示:

a = [Reuters, The New York Times, The Wall Street Journal, Associated Press, Financial Times]
ranking = [ 'The Wall Street Journal', 'The New York Times', 'Associated Press', 'Reuters', 'Financial Times', 'USA Today','Bloomberg','CNBC']

for element in ranking:
  for i in a:
    if i == element:
      print(i)
结果:

The Wall Street Journal
The New York Times
Associated Press
Reuters
Financial Times

您不了解哪一部分:如何让用户输入列表,或者在输入后如何对其进行排序?如前所述,您的问题太广泛了。感谢您的回答,我想知道如何根据排名对输入的列表进行排序,以下是我拥有的:
code
ranking=[《华尔街日报》、《纽约时报》、《美联社》、《路透社》、《金融时报》、《今日美国》、《彭博社》、《CNBC》]印刷版(“输入新报道:”)coverage=input()列出=coverage.split()打印(*列出,sep=“\n”)请不要在注释中发布代码。编辑原始问题。