python - Encode/decode C-string literals -


I have a text file that behaves like a C string. For example:

  some = "some text \ nin two lines \ tand tab"; SomethingElse = "\" quote \ "" with some text; ";  

Getting things between quotes is not a problem. The problem is that later I am processing this string and it turns out that the slash is exiting. < / P>

I want to decode these stars, execute them, then encrypt them back into the C-string literal.

Then from that raw input

 < I want to code> some text \\ line wrap \ n and \ "quotation \"  

:

  line : :   

I have found for processing ( string_escape ), what is required for me, but since I'm processing the c-string, it is useless. Tried to find another codec but there is no luck yet.


Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -