Can someone explain why ^ symbol ( ^^^mystring) doesn't seem to effect results? (Anything else will) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can someone explain why ^ symbol ( ^^^mystring) doesn't seem to effect results? (Anything else will)

import re str = "mystring" search = "^^^mystring" if re.match(search,str): print("time") else: print("emit") result: time If I put anything else where ^^^ symbol is it changes the result?

10th Sep 2018, 10:22 PM
Mr M
Mr M - avatar
2 Answers
+ 2
the output is time because the string is all there lined up like it was written in the variable. if you changed it to something like my^^^string the output would be emit https://code.sololearn.com/cKi287NMauA3/?ref=app
10th Sep 2018, 10:46 PM
LONGTIE👔
LONGTIE👔 - avatar
12th Sep 2018, 3:45 PM
Mr M
Mr M - avatar