Using Pound Sign As A String In Python?
I want to have a string containing 4 pound signs..how can I accomplish this in Python without commenting the string out due to the pound signs?
Solution 1:
What about:
x = '####'
If between quotes, it will not be a comment!
Solution 2:
As said before, single quotes do the job for string literals. You might also want to have a look at Python documentation
Solution 3:
If some IDE interprets '####' as a half-baked string plus a comment, change the IDE!
Post a Comment for "Using Pound Sign As A String In Python?"