How to implement multiple% s list expansion in python

suppose there is a string like this:

fmt = %s,%s,%s

and the corresponding data is [1JI 2jue 3]. Now you want to expand the list automatically when formatting:

fmt = fmt % (*[1,2,3])

you can get the result 1 , instead of grammatical errors.

Mar.01,2021

can be implemented in the following way,

fmt = fmt % tuple([1,2,3])

so you get the data results without syntax errors.


give it a try. You can't use an asterisk expression to expand a list into a tuple , which will report

.
SyntaxError: can't use starred expression here

but you can

fmt% tuple ([1,2,3])


add multiple commas to indicate tuple

fmt = '%s, % s, % s'
fmt = fmt % (*[1, 2, 3], )
print(fmt)
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3663c-4104e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3663c-4104e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?