qiskit/tools/apps/optimization.py
def Hamiltonian_from_file(file_name):
    """Creates a matrix operator out of a file with a list
    of Paulis.

    Args:
        file_name (str): a text file containing a list of Paulis and
        coefficients.
    Returns:
        list: A matrix representing pauli_list
    """
    with open(file_name, 'r+') as file:
        ham_array = file.readlines()
    ham_array = [x.strip() for x in ham_array]
    pauli_list = []
    for i in range(len(ham_array) // 2):
        pauli = label_to_pauli(ham_array[2 * i])
        Numb = float(ham_array[2 * i + 1])
        pauli_list.append([Numb, pauli])
    return pauli_list
Creates a matrix operator out of a file with a list
    of Paulis.

    Args:
        file_name (str): a text file containing a list of Paulis and
        coefficients.
    Returns:
        list: A matrix representing pauli_list
    
Creates a matrix operator out of a file with a list
of Paulis.

file_name (str): a text file containing a list of Paulis and
coefficients.
Returns:
list: A matrix representing pauli_list
Creates a matrix operator out of a file with a list of Paulis . file_name ( str ) : a text file containing a list of Paulis and coefficients . Returns : list : A matrix representing pauli_list
def Hamiltonian_from_file(file_name):
    with open(file_name, 'r+') as file:
        ham_array = file.readlines()
    ham_array = [x.strip() for x in ham_array]
    pauli_list = []
    for i in range(len(ham_array) // 2):
        pauli = label_to_pauli(ham_array[2 * i])
        Numb = float(ham_array[2 * i + 1])
        pauli_list.append([Numb, pauli])
    return pauli_list
def Hamiltonian_from_file ( file_name ) : with open ( file_name , 'r+' ) as file : ham_array = file . readlines ( ) ham_array = [ x . strip ( ) for x in ham_array ] pauli_list = [ ] for i in range ( len ( ham_array ) // 2 ) : pauli = label_to_pauli ( ham_array [ 2 * i ] ) Numb = float ( ham_array [ 2 * i + 1 ] ) pauli_list . append ( [ Numb , pauli ] ) return pauli_list
Creates a matrix operator out of a file with a list
of Paulis.
Creates a matrix operator out of a file with a list of Paulis .
"""Creates a matrix operator out of a file with a list
    of Paulis.

    Args:
        file_name (str): a text file containing a list of Paulis and
        coefficients.
    Returns:
        list: A matrix representing pauli_list
    """
file_name