Scratch Py

Search for index

array_index = array.index(value)

Read specified number of bytes from buffer.

binary_string = b"\xd3\x00\x13>\xd0\x00\x03\x8aX\xd9I<\x87/4\x10\x9d\x07\xd6\xafH Z\xd7\xf7"
binary_string[:1]

Store a list of dict

Same length of arrays

    data1 = []
    data2 = []
    data = pd.DataFrame({
        'data1':data1, 
        'data2':data2
        })

Variable lengths

    data= pd.concat(
        [pd.DataFrame(data1),
         pd.DataFrame(data2)],axis=1)

Test if varaible is a string

isinstance(a[2], str)

Generate a pseudo-random filename

def generate_filename(seed_values, length):
    seed = ''.join(seed_values)
    random.seed(seed)
    filename = ''.join(random.choices(string.ascii_lowercase + string.digits, k=length))
    return filename
Next