小编Cus*_*tem的帖子

如何从python中的元组中提取简单的字符串(新手问题)

我有一个相当大的元组,其中包含:

[('and', 44023), ('cx', 37711), ('is', 36777) .... ]
Run Code Online (Sandbox Code Playgroud)

我只想提取由单引号分隔的第一个字符串,因此上面元组的输出将是:

and
cx
is
Run Code Online (Sandbox Code Playgroud)

我该如何编码(在某种程度上内置了可扩展性)?

python string parsing tuples

5
推荐指数
2
解决办法
8132
查看次数

标签 统计

parsing ×1

python ×1

string ×1

tuples ×1