Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- >>> #import regex library
- ... import re
- >>>
- >>> #use a regex to just get the numbers -- not the rest of the string
- ... matcht = re.findall(r'd', dwtunl)
- >>> matchb = re.findall(r'd', ambaas)
- >>> #macht = re.search(r'dd', dwtunl)
- ...
- >>> #just a test to see about my regex
- ... print matcht.group()
- Traceback (most recent call last):
- File "<stdin>", line 2, in <module>
- AttributeError: 'list' object has no attribute 'group'
- >>> print matchb.group()
- Traceback (most recent call last):
- File "<stdin>", line 1, in <module>
- AttributeError: 'list' object has no attribute 'group'
- >>>
- >>> #start defining the final variables
- ... if dwtunl == "No Delay":
- ... dwtunnl = 10
- ... else:
- ... dwtunnl = matcht.group()
- ...
- Traceback (most recent call last):
- File "<stdin>", line 5, in <module>
- AttributeError: 'list' object has no attribute 'group'
- >>> if ambaas == "No Delay":
- ... ammbaas = 10
- ... else:
- ... ammbaas = matchb.group()
- ...
- Traceback (most recent call last):
- File "<stdin>", line 4, in <module>
- AttributeError: 'list' object has no attribute 'group'
- >>> import re
- >>> regex = re.compile(r"(w)(W)")
- >>> regex.findall("A/1$5&")
- [('A', '/'), ('1', '$'), ('5', '&')]
- >>> for match in regex.finditer("A/1$5&"):
- ... print match.group(1), match.group(2)
- ...
- A /
- 1 $
- 5 &
- for i in stored_list
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement