io_mod.py
def list2str_1d(nums, mid = -1):
    """ 
    Give a list of nums, output the head, the middle, and the tail of it
    with nice format. Return the formatted string.

    Args:
    mid: define the middle point you are interested in
    """

    nvis = 3 # numbers printed out in each part
    l = len(nums) 
    mid = mid if mid > 0 else l / 2
    fmtstr = '{0:.4f} '
    resstr = ''
    for i in range(min(nvis, l)):
        resstr += fmtstr.format(nums[i])
    irange = range(max(nvis + 1, int(mid - nvis / 2)), min(l, int(mid + nvis / 2 + 1)))
    if len(irange) > 0: resstr += ' ... '
    for i in irange:
        resstr += fmtstr.format(nums[i])
    irange = range(max(int(mid + nvis / 2 + 1), l - nvis), l)
    if len(irange) > 0: resstr += ' ... '
    for i in irange:
        resstr += fmtstr.format(nums[i])
    return resstr
 
    Give a list of nums, output the head, the middle, and the tail of it
    with nice format. Return the formatted string.

    Args:
    mid: define the middle point you are interested in
    
Give a list of nums, output the head, the middle, and the tail of it
with nice format. Return the formatted string.

define the middle point you are interested in
Give a list of nums output the head the middle and the tail of it with nice format . Return the formatted string . define the middle point you are interested in
def list2str_1d(nums, mid = -1):
    nvis = 3 
    l = len(nums) 
    mid = mid if mid > 0 else l / 2
    fmtstr = '{0:.4f} '
    resstr = ''
    for i in range(min(nvis, l)):
        resstr += fmtstr.format(nums[i])
    irange = range(max(nvis + 1, int(mid - nvis / 2)), min(l, int(mid + nvis / 2 + 1)))
    if len(irange) > 0: resstr += ' ... '
    for i in irange:
        resstr += fmtstr.format(nums[i])
    irange = range(max(int(mid + nvis / 2 + 1), l - nvis), l)
    if len(irange) > 0: resstr += ' ... '
    for i in irange:
        resstr += fmtstr.format(nums[i])
    return resstr
def list2str_1d ( nums , mid = - 1 ) : nvis = 3 l = len ( nums ) mid = mid if mid > 0 else l / 2 fmtstr = '{0:.4f} ' resstr = '' for i in range ( min ( nvis , l ) ) : resstr += fmtstr . format ( nums [ i ] ) irange = range ( max ( nvis + 1 , int ( mid - nvis / 2 ) ) , min ( l , int ( mid + nvis / 2 + 1 ) ) ) if len ( irange ) > 0 : resstr += ' ... ' for i in irange : resstr += fmtstr . format ( nums [ i ] ) irange = range ( max ( int ( mid + nvis / 2 + 1 ) , l - nvis ) , l ) if len ( irange ) > 0 : resstr += ' ... ' for i in irange : resstr += fmtstr . format ( nums [ i ] ) return resstr
Give a list of nums, output the head, the middle, and the tail of it
with nice format.
Give a list of nums output the head the middle and the tail of it with nice format .
""" 
    Give a list of nums, output the head, the middle, and the tail of it
    with nice format. Return the formatted string.

    Args:
    mid: define the middle point you are interested in
    """ # numbers printed out in each part
nums
mid