0

I need an example...

Could anyone give an example of one question inthe python course?.... that question is in regular expresions/simple metacharacters, is the second one, i need to see a "no new lines" example of that not matching(sorry for my inglish thia is not my native language)

5th Jan 2019, 10:14 PM
Razf
Razf - avatar
2 Respostas
+ 2
What would '....' match? - Any four character string with no new lines. Here's an example of that: import re pattern = r"...." if re.match(pattern, "abcd"): print("Match 1") if re.match(pattern, "1234"): print("Match 2") # New line character is "\n" if re.match(pattern, "abc\n"): print("Match 3") if re.match(pattern, "
amp;@?"): print("Match 4") Output: Match 1 Match 2 Match 4
5th Jan 2019, 11:02 PM
Diego
Diego - avatar
0
Thanks!!!
5th Jan 2019, 11:35 PM
Razf
Razf - avatar