-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLibraries.py
More file actions
30 lines (29 loc) · 988 Bytes
/
Libraries.py
File metadata and controls
30 lines (29 loc) · 988 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import re
re.match() #Returns first match
re.search() #Returns
re.findall() #Returns a list containing all matches
re.sub() #Replaces one or many matches w/ a string
re.split() #Returns a list where string has been split at end of each match
#Creating RegExs
#Goes in single quotes
pattern = ['A-Za-z'] #Set of characters []
pattern = '.' #Any character .
pattern = '^x' #Starts with ^
pattern = 'x$' #Ends with $
pattern = 'x*' #Zero or more occurences of previous character *
pattern = 'x+' #One or more occurences of previous character +
pattern = '?' #Zero or one occurences of previous character ?
pattern = 'x{3}' #Exactly x occurences of previous character {}
pattern = 'a|b' #Either or |
import itertools
import collections
import math
import random
import string
import os
import sys
import subprocess
import argparse
import datetime
import unittest
import numpy