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

HTML/CSS - Automatically set height width from background image? -

php - Mysql Show Process - Sleep Commands and what to do -

c - What is the address of buf (the local variable in the main function)? -