如何根据十大热门排列这些数据?

时间:2017-12-04 23:31:18

标签: python

如何根据本周十大热门歌曲安排此事?

Billboard Hot 100 - Top 50 - Week of Dec 2, 2017                    
This Week   Last Week   Peak Position   Weeks on List   Title   Artist(s)
1   1   1   9   Rockstar    Post Malone Featuring 21 Savage
2   2   2   14  Havana  Camila Cabello Featuring Young Thug
3   12  3   10  Gucci Gang  Lil Pump
4   5   4   29  Thunder Imagine Dragons
5   3   1   20  Bodak Yellow (Money Moves)  Cardi B
6   4   4   10  Too Good At Goodbyes    Sam Smith
7   8   7   12  Perfect Ed Sheeran
8   6   3   29  1-800-273-8255  Logic Featuring Alessia Cara & Khalid
9   7   4   22  Feel It Still   Portugal, The Man
10  10  3   20  Mi Gente    J Balvin & Willy Wiliam Featuring Beyonce
11  9   9   12  What Lovers Do  Maroon 5 Featuring Featuring SZA
12  11  6   19  Sorry Not Sorry Demi Lovato
13  13  13  10  No Limit    G-Eazy Featuring A$AP Rocky & Cardi B
14  0   14  1   Walk On Water   Eninem Featuring Beyonce
15  23  14  3   Motorsport  Migos, Nicki Minaj & Cardi B
16  14  11  13  I Get The Bag   Gucci Mane Geaturing Migos
17  20  17  11  Bad At Love Halsey
18  30  4   11  ...Ready For It?    Taylor Swift
19  21  19  16  New Rules   Dua Lipa
20  17  13  15  What About Us   Pink
21  16  3   32  Unforgettable   French Montana Featuring Swae Lee
22  18  1   44  Despacito   Luis Fonsi & Daddy Yankee Featuring Justin Bieber
23  22  8   20  Rake It Up  Yo Gotti Featuring Nicki Minaj
24  19  5   30  Attention   Charlie Puth
25  29  25  8   I Fall Apart    Post Malone
26  24  4   41  Believer    Imagine Dragons
27  15  12  19  Bank Account    21 Savage
28  28  22  19  Praying Kesha
29  25  25  18  Young Dumb & Broke  Khalid
30  36  1   45  Shape of You    Ed Sheeran
31  37  1   13  Look What You Made Me Do    Taylor Swift
32  32  10  26  Strip That Down Liam Payne Featuring Quavo
33  33  6   30  There's Nothing Holdin' Me Back Shawn Mendes
34  36  1   44  That's What I Like  Bruno Mars
35  34  11  29  Slow Hands  Niall Horan
36  40  8   47  Congratulations Post Malone Featuring Quavo
37  31  31  12  The Way Life Goes   Lil Uzi Vert Featuring Nicki Minaj
38  43  38  16  The Weekend SZA
39  38  33  16  When It Rains It Pours  Luke Combs
40  44  40  6   How Long    Charlie Puth
41  0   18  21  Love    Kendrick Lamar Featuring Zacari
42  41  40  23  Do Re Mi    Blackbear
43  39  26  23  What Ifs    Kane Brown Featuring Lauren Alaina
44  54  42  14  Silence Marshmello Featuring Alaina
45  52  45  11  Greatest Love Story LANCO
46  47  46  10  Phil and Automobiles    Chris Brown Featuing Yo Gotti, A Boogie Wit da Hoodie & Kodak Black
47  46  1   33  Humble  Kendrick Lamar
48  45  7   34  XO TOUR Llif3   Lil Lizi Vert
49  42  3   39  Something Just Like This    The Chainsmokers & Coldplay
50  51  45  21  Crew    Goldlink Featuring Brent Faiyaz & Shy Glizzy

1 个答案:

答案 0 :(得分:0)

编辑:数据未像这样解析。但是如果数据是单字符串的话,我的答案仍然有用,我相信这很容易实现。

如果您需要有关代码的帮助,请发布您目前为止尝试过的代码。

您需要在解析的文本中识别模式。 例如,在这里,您可以注意到文本的第一行不是您所寻求的;但其他所有人都很有意思。

你甚至可以看到每个顶部都是由一系列 4位数字从1到2的长度“宣布”的。也许可以分开吗? 正则表达式可能会有所帮助。

这几乎是你需要知道的一切。

EDIT_2:我的回答也是有效的,她通过访问正确的索引将数据转换为长度为2([[],[]]的二维数组。