I have a list of strings: ['John','William','Ken','Rogers']
. I need to prepend "Corp\"
to each element in the list so that the final list looks like this:
['Corp\John','Corp\William','Corp\Ken','Corp\Rogers']
I tried the following:
s=['John','William','Ken','Rogers']
users=['Corp\\' + m for m in s]
print(users)
The output gives me
['Corp\\John','Corp\\William','Corp\\Ken','Corp\\Rogers']
If I try users=['Corp\' + m for m in s]
I get an obvious error:
"StringError EOL while scanning string literal"
I would need each element in the exact form 'Corp\name'
, as this needs to be used in a for loop to validate users who are eligible to login.