creating a list from json csv file using python
Question: I am sorry for asking this question, but i already look through but could not
find the answer. I am honestly newbie.I am trying to generate a list of whole
word from a json csv file. I already created a list of lines, but then i
cannot use split() to generate new list containing separate word (later i need
to count word occurrence). My input file contains twitter information:
[twitter data](http://i.stack.imgur.com/hV182.jpg) i tried to write simple
code:

    
    
    myfile=open('fileName','r')
    words=[]
    for line in myfile:
        words.append(line.split())
    
    len(words)=82
    

I also tried reader=csv.reader(myFile) and reader=csv.DictReader(myFile)

but in all I can get each line, but how to further split the string/line into
independent word. Sorry and thank you in advanced.

My data #I change to a different example as maybe last one was bad formatted:

    
    
    id,flags,expiration,cas,value
    493926581610364928,0,0,2635740904247446,"{""contributors"":null,""truncated"":false,""text"":""@xaaronh @blueredandgold If Namco Bandai's One Piece Unlimited World is anything to go by, no local retail release means no eShop either =\\"",""in_reply_to_status_id"":493925918998425600,""id"":493926581610364928,""favorite_count"":0,""source"":""<a href=\""hp://twitter.com\"" rel=\""nofollow\"">Twitter Web Client</a>"",""retweeted"":false,""coordinates"":null,""entities"":{""symbols"":[],""user_mentions"":[{""id"":139852376,""indices"":[0,8],""id_str"":""139852376"",""screen_name"":""xaaronh"",""name"":""Aaron""},{""id"":74393990,""indices"":[9,24],""id_str"":""74393990"",""screen_name"":""blueredandgold"",""name"":""Leigh""}],""hashtags"":[],""urls"":[]},""in_reply_to_screen_name"":""xaaronh"",""in_reply_to_user_id"":139852376,""retweet_count"":0,""id_str"":""493926581610364928"",""favorited"":false,""user"":{""follow_request_sent"":false,""profile_use_background_image"":true,""default_profile_image"":false,""id"":42302246,""profile_background_image_url_hp"":""hp://pbs.twimg.com/profile_background_images/464279459932020736/v1xnMcrV.jpeg"",""verified"":false,""profile_text_color"":""333333"",""profile_image_url_https"":""hp://pbs.twimg.com/profile_images/490791031487463424/udSldTQ3_normal.png"",""profile_sidebar_fill_color"":""DDEEF6"",""entities"":{""description"":{""urls"":[{""url"":""hp:tttt"",""indices"":[67,89],""expanded_url"":""hp://infernalmonkey.com"",""display_url"":""infernalmonkey.com""}]}},""followers_count"":506,""profile_sidebar_border_color"":""000000"",""id_str"":""42302246"",""profile_background_color"":""1A1B1F"",""listed_count"":22,""is_translation_enabled"":false,""utc_offset"":36000,""statuses_count"":8676,""description"":""I probably tweet about video games and onaholes. Let's be friends! (NSFW)"",""friends_count"":261,""location"":""Sydney, Australia"",""profile_link_color"":""2FC2EF"",""profile_image_url"":""hp://pbs.twimg.com/profile_images/490791031487463424/udSldTQ3_normal.png"",""following"":false,""geo_enabled"":false,""profile_banner_url"":""hp://pbs.twimg.com/profile_banners/42302246/1406105444"",""profile_background_image_url"":""hp://pbs.twimg.com/profile_background_images/464279459932020736/v1xnMcrV.jpeg"",""screen_name"":""infernal_monkey"",""lang"":""en"",""profile_background_tile"":false,""favourites_count"":2018,""name"":""Lance McGill"",""notifications"":false,""url"":null,""created_at"":""Sun May 24 23:20:25 +0000 2009"",""contributors_enabled"":false,""time_zone"":""Sydney"",""protected"":false,""default_profile"":false,""is_translator"":false},""geo"":null,""in_reply_to_user_id_str"":""139852376"",""lang"":""en"",""_id"":""493926581610364928"",""created_at"":""Tue Jul 29 01:10:48 +0000 2014"",""in_reply_to_status_id_str"":""493925918998425600"",""place"":null,""metadata"":{""iso_language_code"":""en"",""result_type"":""recent""}}"
    


Answer: This is not the best solution, just an effort from a noob (me), definitely
need further editing for better output. I am using windows OS.

    
    
    import csv
    import json
    abc=[]
    myList=[]
    myDict={}
    myFile=open('fileName.csv','r',encoding='utf-8')
    myReader=csv.reader(myFile)
    header=next(myReader)
    for line in myReader:
         abc=json.loads(line[4])
         myDict=abc
         myList.append(myDict['text'])
    dct={}
    for eachLine in myList:
        item=eachLine.split()
        for one in item:
            if one in dct:
               dct[one]+=1
            else:
               dct[one]=1
    finalList=list(dct.items())
    finalList.sort()
    

