def transform_products_to_list(products_string): string_list = products_string.split('\n') new_string_list = [x for x in string_list if x != ''] final_list = [] for i in range(len(new_string_list)): final_list.append(new_string_list[i].split(',')) return final_list
def transform_products_to_list(products_string): split_products = products_string.split('\n') products_list = [] for product_line in split_products: if product_line: #if product is True ..... if product != '' product = product_line.split(',') products_list.append(product) return products_list
def transform_products_to_list(products_string): splitted = products_string.split('\n') products = [] for item in splitted: if item: clean_item = item.split(',') products.append(clean_item) return products
def transform_products_to_list(products_string): products_string_splitted = products_string.split('\n') product_list = [] for product in products_string_splitted: if product: product_list.append(product.split(',')) return product_list
def transform_products_to_list(products_string): products_splote = products_string.split('\n') products_list = [] for product in products_splote: if product: #basically if product exists clean_product = product.split(',') products_list.append(clean_product) return products_list
def transform_products_to_list(products_string): products_splot = products_string.split('\n') results = [] for product in products_splot: if product: clean_product = product.split(',') results.append(clean_product) return results
def transform_products_to_list(products_string): data_list = products_string.split("\n") products_list = [] for data in data_list: if data == "": continue product = data.split(',') products_list.append(product) return products_list
def transform_products_to_list(products_string): # split the raw string by new lines split_products = products_string.split('\n') # Still a big list of lists # Have an empty list to rebuild list from parse to store the answers # This will clean up the empty lines (empty lines = '') product_list = [] for product_line in split_products: # Loop through the split up string if product_line: # Checks to see if the product line is not empty; truthy|falsiness # if product_line != '': # If the line string is not empty # product_line type is string product = product_line.split( ',' ) # Returns a list Split by the comma and store into variable product_list.append( product) # Append row list to results list 1 at a time return product_list