Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/338.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/django/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 在产品名称之前添加一个字符串_Python_Django_String - Fatal编程技术网

Python 在产品名称之前添加一个字符串

Python 在产品名称之前添加一个字符串,python,django,string,Python,Django,String,在下面的代码中,我想在添加产品名称之前添加一个名为“ABC”的字符串 table_po= set() for tr in orders: table_po.add(str(tr.product)) table_data.append(table_po) 执行后,它可能类似于ABC=Cat,其中Cat是您可以尝试使用的{tr.product}值 table_po.add(f'ABC={str(tr.product)}')它是python。li.追加(f“ABC:

在下面的代码中,我想在添加产品名称之前添加一个名为“ABC”的字符串

table_po= set()
    for tr in orders:

        table_po.add(str(tr.product))
    table_data.append(table_po)
执行后,它可能类似于ABC=Cat,其中Cat是您可以尝试使用的{tr.product}值

table_po.add(f'ABC={str(tr.product)}')

它是python。li.追加(f“ABC:{tr.xxx}”)