将字符串转换为纯文本

时间:2019-06-23 22:33:56

标签: python python-3.x gspread

list_one = [<Cell R1C1 'Hello'>, <Cell R1C2 'Name'>]

我有一个API函数调用,可以在python中理解此类数据。

my_api_function(list = [<Cell R1C1 'Hello'>, <Cell R1C2 'Name'>])

但是python不会接受此列表,因为列表定义不正确。

我如何将列表写为字符串,并仍然将其传递给上面编写的函数?

预期结果

#SUDO CODE

list_one = ["<Cell R1C1 'Hello'>, <Cell R1C2 'Name'>"]

list_one = list_one.convert_to_text # your solution comes here 

# Such that my_api_function passes as

my_api_function(list = [<Cell R1C1 'Hello'>, <Cell R1C2 'Name'>])

#as oppose to

my_api_function(list = ["<Cell R1C1 'Hello'>, <Cell R1C2 'Name'>]")

# Note that removing the quotes is my major issue

0 个答案:

没有答案