-1

I'm trying to print out a list and strip the " ' " (single quotes) character from a list I generated from a CSV File.

Here's the code I have

import numpy as np
import pandas as pd

export = pd.read_csv('File') #open file
skuList = export.values.T[0].tolist() #transpose DF + convert to list
#print(skuList)
skuList = [value.strip(" ' ") for value in skuList] #strip ' ' '
print(skuList)

The output from this program is 'GL2i-RS-36', '523-30', 'RK623-30', ....

The output that I would want would be: GL2i-RS-36, 523-30, RK623-30, ....

Is there a way to print out a list without the single quotes?

chrisHG
  • 80
  • 1
  • 2
  • 18
  • You're printing a list so you'll get the string representation of each item in the list. See the difference between `print(["a", "b", "c"])` vs. `print(", ".join(["a", "b", "c"]))`. –  Jan 25 '21 at 23:40

1 Answers1

0

Maybe try this (without the spaces around the '):

skuList = [value.strip("'") for value in skuList] #strip ' ' '
thehand0
  • 1,123
  • 4
  • 14