Issue
I have the following list :
StringTest = ['A','B','C','D']
The output excepted is :
"'A','B','C','D'"
but it seems that the '' are perma deleted.
Below is the code I tried :
StringTest = ['A','B','C','D']
StringTest = ','.join(StringTest )
print(StringTest )
which returns :
"A,B,C,D"
How can I do ?
Solution
You could do it like this:
StringTest = ['A','B','C','D']
print('"'+','.join(f"'{s}'" for s in StringTest)+'"')
Output:
"'A','B','C','D'"
Answered By - Cobra
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.