Nov-01-2020, 01:40 AM
(Oct-31-2020, 06:20 PM)bowlofred Wrote: Before line4, if you add this, what is the output? I can't tell where your v_str_sev is getting its data.
print(type(v_str_sev))If it's a str, then you need to figure out where the data is coming from and fix it there.
The output is :
<class 'str'>And when I press the variable (v_str_sev), the result I have is exactly this:
print(v_str_sev) -> MiniFieldStorage('v_name', 'João'), MiniFieldStorage('v_sname', 'Aguiar')Note that there are no double quotes at the beginning and end.
Double quotes appear only when I re-string the string by inserting the variable (v_str_sev) between the brackets as the value of the attribute (list) of the instantiated v_field object of the FieldStorage class, as shown in the example below :
from cgi import FieldStorage v_field = FieldStorage() v_field.list = [v_str_sev] print(v_field) -> FieldStorage(None, None, ["MiniFieldStorage('v_name', 'João'), MiniFieldStorage('v_sname', 'Aguiar')"])Note that the data type is now, that it is almost correct, missing the double quotes from the beginning and end ?
<class 'cgi.FieldStorage'> -> FieldStorage(None, None, ["MiniFieldStorage('v_name', 'João'), MiniFieldStorage('v_sname', 'Aguiar')"])