Aug-15-2017, 10:30 PM
I have a webpage in the variable soup
I try to search it with a regx but get an error
TypeError: expected string or bytes-like object
If I set soup equal some garbage characters with my 'target' in the middle...
soup = ("adklfjdkd 12345 xyz target dfkdkfj")
it works.
I think I need to convert the webpage soup to a "raw" string but I'm unsure how to do this for a string already in a variable.
Normally I would do something like... myString = (r"bla bla bla") # I think
But if you already have the string in a variable how do you make it a "raw" string" ?
I'm guessing concatenate but an example would really be helpful as it has been a very long day :-)
Thanks for any help.
I try to search it with a regx but get an error
TypeError: expected string or bytes-like object
If I set soup equal some garbage characters with my 'target' in the middle...
soup = ("adklfjdkd 12345 xyz target dfkdkfj")
it works.
I think I need to convert the webpage soup to a "raw" string but I'm unsure how to do this for a string already in a variable.
Normally I would do something like... myString = (r"bla bla bla") # I think
But if you already have the string in a variable how do you make it a "raw" string" ?
I'm guessing concatenate but an example would really be helpful as it has been a very long day :-)
Thanks for any help.