Dec-16-2019, 11:39 PM
@BamBi25
i modified the test string:
i modified the test string:
import re string = "XfooYbarXbooYfar" regex = re.compile('^(X[^Y]+)(Y[^X]+)$') final2 = [] m = regex.match(string) [final2.append(items) for items in m.group(1, 2)] print(final2)which seems to have a problem:
Output:t2a/forums /home/forums 15> cat -n foo.py
1 import re
2 string = "XfooYbarXbooYfar"
3 regex = re.compile('^(X[^Y]+)(Y[^X]+)$')
4 final2 = []
5 m = regex.match(string)
6 [final2.append(items) for items in m.group(1, 2)]
7 print(final2)
lt2a/forums /home/forums 16> py3 foo.py
Traceback (most recent call last):
File "foo.py", line 6, in <module>
[final2.append(items) for items in m.group(1, 2)]
AttributeError: 'NoneType' object has no attribute 'group'
lt2a/forums /home/forums 17>
Tradition is peer pressure from dead people
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.