List with strings to list with raw strings | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

List with strings to list with raw strings

I need to create a list with raw strings provided a list with strings. Does anyone of you know how to do that? https://code.sololearn.com/c6MUJK7pgSup/?ref=app I tried several ways.

28th Mar 2018, 2:41 PM
Bernardo Bernardino Gameiro
Bernardo Bernardino Gameiro - avatar
1 Answer
0
>>> plain = "\\a\a\a\b" >>> raw = r"\\a\a\a\b" >>> print plain \a >>> print raw \\a\a\a\b >>> plain == raw False >>> temp = "%r" % plain >>> new = temp[1:-1] >>> print new \\a\x07\x07\x08 >>> print raw \\a\a\a\b >>> new == raw False >>> this program is to rawify string .There are different strings to be used in strings
30th Jun 2018, 4:16 AM
Yuvraj Singh
Yuvraj Singh - avatar