I need to do a simple code as follow below but I unable to overcome how insert raw data in list.
lsttemp = []
with open (f'{dirworklnx}/logid0101039426.txt', 'r', encoding='UTF-8') as var01:
lstgerada = var01.readline().removeprefix('{').removesuffix('}').strip().split(', ')
for m in lstgerada:
dadosdic02 = m.strip().rstrip().lstrip().replace('}','').replace('\'','').replace(' ','')
chave01 = fR"{(dadosdic02[0:-2])}"
print(chave01)
# until here , that´s ok.
# I have the string which I need to insert in my list "lsttemp"
lsttemp.append(str(chave01))
# THIS THE POINT! it´s always add scape characters as "\\".
# I Should like that my data was raw data as is in original
# string from variable "chave01"
print(lsttemp)
Output of this code is:
The first print:
.\\aguser
user.martins
scan
migrate
The second print:
['.\\\\aguser', 'user.martins', 'scan', 'migrate']
It adds two more "\" in string ".\aguser".
How can I insert raw data in list regardless special characters?