Nov-01-2020, 02:23 AM
I am confused. You cannot do this: "How do I remove the double quotes keeping the data type as class (FieldStorage) and not (string)?". Everything that is printed is converted to a string, and the result is None with a side effect of drawing the characters to stdout. I occasionally see posts here where the author uses a print statement to display data and is concerned about an decorations that might be appended or removed by the print statement. The print statement is only displaying the result of __str__(thing) or __repr__(thing), and not the actual thing. Why do you think it is important to not have the quotes? Sure you can change how the string is constructed and avoid the quotes, but it is still a string.
To expand slightly on bolofred's example:
To expand slightly on bolofred's example:
a = 'foo\'bar' b = 'foobar' print(a, b) print([a, b]) print(f'[{a}, {b}]')
Output:foo'bar foobar
["foo'bar", 'foobar']
[foo'bar, foobar]
When printing strings that are in a list, Python wraps the string in quotes. If the string includes a single quote Python wraps the string in double quotes. To remove the quotes you have to format the string yourself. The last print does not show quotes because it is not printing a list. It prints two strings surrounded by brackets. I don't know if this is applicable to your problem.