How to extract contents of a csv file and place them in a dict file type without using csv module. [python]
Question: Here is the information in the file:

    
    
    "Part no.","Description","Price"
    "453","Sperving_Bearing","9900"
    "1342","Panametric_Fan","23400"
    "9480","Converter_Exchange","93859"
    

I'm trying to figure out how to open up a file and then store it's contents
into a dictionary using the Part no. as the key and the other information as
the value. So I want it to look something like this:

    
    
    {Part no.: "Description,Price", 453: "Sperving_Bearing,9900", 1342: "Panametric_Fan,23400",9480: "Converter_Exchange,93859"}
    

I was able to store the text from the file into a list, but I'm not sure how
to assign more than one value to a key. I'm trying to do this without
importing any modules. I've been using the basic str methods, list methods and
dict methods. Here is my code so far: ( I'm assuming the filename will
correctly be entered)

    
    
    textname = input("ENter a file")
    thetextfile = open(textname,'r')
    print("The file has been successfully opened!")
    thetextfile = thetextfile.read()
    file_s = thetextfile.split()
    holder = []
    ck = 0
    for c in range(len(file_s)):
       holder.append(file_s[c])
       ck = ck+1
       if(ck == 3):
           holder.insert(c,'\n')
           count = 0
    holder_string = "".join(holder)
    holder = holder_string.split("\n")
    wordlist = {}
    
    #kind of stuck here.
    


Answer: Perhaps like this:

    
    
    wordlist = {}
    with open(textname, 'r') as thetextfile:
      for line in thetextfile:
        line = line.split()
        wordlist[line[0]] = line[1:]
    

That makes the dict values the (more convenient) list of remaining items. But,
if you really wanted the "," string syntax that you have above, maybe:

    
    
    wordlist = {}
    with open(textname, 'r') as thetextfile:
      for line in thetextfile:
        line = line.split()
        wordlist[line[0]] = ",".join(line[1:])
    

