Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

So i've downloaded python two weeks ago, code is working, had few problems on libraries that were interrupted due to two versions of python 3.7 & 3.9, I deleted the older one and now it CAN find the libraries but CAN'T show them..

from matplotlib.pylab import plt

abc = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z',]

def countp(counter):
    count=0
    for i in counter:
        print(abc[count],"showed up ",i," times")
        count+=1

def checkfile(folder):     
    file = open(folder,"r")
    read=file
    abc = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z',]
    counter = [0]*26
    #read file
    for i in file:
        # reads line
        for j in i:
            count=0
            #search one key at a time
            for k in abc:
                if (j==k.lower()):
                    #add +1 to desired letter. 
                    counter[count]+=1
                count+=1
    return counter

if __name__ == "__main__":
    folder="C:/Users/omerd/Desktop/Welp.txt"
    counter=checkfile(folder)
    countp(counter)
    x=5
    y=6
    plt.plot(x,y)
    

it does run, but it doesn't use the

    plt.plot(x,y)

line, it should open a chart, but it doesn't, not sure if newbie mistake or need to reInstall everything


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
1.4k views
Welcome To Ask or Share your Answers For Others

1 Answer

Many Documentations Don't mention this but try adding plt.show() at the after plst.plot(). plt.show() is just to open the matplotlib plot


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share

548k questions

547k answers

4 comments

86.3k users

...