简体   繁体   English

如何在 Python 的列表中创建列表? 可能吗?

[英]How do I create lists in a list in Python? Is it possible?

How to make list each character of list?如何列出列表的每个字符? like this:像这样:

li = ['A','B','C']

into:进入:

li = [['A'],['B'],['C']]

See "list comprehension".请参阅“列表理解”。

It is simply,很简单,

[[i] for i in i]

or more generally,或者更一般地说,

[f(x) for x in list_name]

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Python:有可能有一个列表列表吗? 以及如何拨打特定列表? - Python: Is it possible to have a list of lists? and how do I call a particular list? 如何在Python中创建所有可能的元素分组列表 - How to create all possible groupings of elements as list of lists in Python 在 python 中,如何创建列表列表,其中每个列表都包含开始和结束日期的字符串表示形式? - In python, how do I create a list of lists where each list contains a string representation of a start and end date? python 3:如何在可能的参数列表上运行一个函数并返回所有结果的字典 - python 3: how do I run a function over a list of lists of possible parameters and returning a dictionary of all results 如何在Python中创建包含不同变量的列表列表(矩阵)? - How do I create a List of lists (matrix) containing different variables in Python? 如何在Python中创建列表列表以存储文本列表? - How may I create list of lists in Python to store list of texts? 如何找到列表列表的所有可能组合(在Python中)? - How can I find all the possible combinations of a list of lists (in Python)? 如何在Python中创建列表列表 - How to create a list of lists in Python 如何将整数的Python列表转换为列表列表? - How do I convert a Python list of integers into a list of lists? 如何将元素列表与 Python 中的另一个列表列表相乘 - How do I multiply a list of elements with another list of lists in Python
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM