Py学习  »  Python

如何在python中创建一个只包含数字和单词/短语的新列表?

QMan5 • 5 年前 • 1577 次点击  

当前列表如下: line_list = ['Rent 350', 'Gas 60', 'Food 50', 'Clothing 40', 'Car Payment 500', 'Electric Bill 150', 'Cell Phone Bill 150', 'Miscellaneous 10']

我希望输出如下:

labels = ['Rent', 'Gas', 'Food', 'Clothing', 'Car Payment', 'Electric Bill', 'Cell Phone Bill', 'Miscellaneous']
amount = ['350', '60', '50', '40','500','150', '150', '10']

基本上,我试图将列表分成一个只有数字的列表和一个包含单词/短语的列表。

Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/50014
 
1577 次点击  
文章 [ 2 ]  |  最新文章 5 年前