Okay, so I tried to look for a solution for about one hour and couldn't find anything that works. Let me describe the problem.
I have a simple html form where the user uploads a file (.csv) and then also gives a delimiter for that file that I will be using to read it. The problem arises when the user submits a tab delimiter \t
. When I try to access it in django
delimiter = request.POST['delimiter']
I get a string \\t
which just corresponds to a string \t
(not a tab). Is there a way to read the input as a tab or somehow convert anything with the escape character to the right form. The only way I figured out would be to do
delimiter.replace('\\t', '\t')
But then I would have to do this for \n
etc. so there has to be a better way.