Python Forum
Thread Rating:
  • 1 Vote(s) - 1 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Elections
#4
def getCandidates(f):
    
    try:
        filename = open(f,'r')
        line = filename.readlines()
        
        print(line) 
        
    except IOError:
        print("File not found.", [])

    
def parseVote(s):
    if s == []:
        print("0")
    elif [ s != [0-9] ]:
        print("-1")
    else:
        print(s)   

def parsePaper(s,n):
    n=0
    for line in open(s):
        n += 1

        
    


def getPapers(f,n):
    try:
        filename = open(f,'r')
        line = filename.read()
        line=[line.replace('\n', ",")]
        print( [line,n] )
             
    except IOError:
        print("File not found.", f)
       

def main():

    candidate=input("Enter candidate file: ")
    getCandidates(candidate)

    
    papers=input("Enter papers file:")
    n=len(papers)
    getPapers(papers,n)

    
    

main()    


    
Reply


Messages In This Thread
Elections - by nacerr - Apr-21-2017, 07:35 AM
RE: Elections - by idontreallywolf - Apr-21-2017, 08:35 AM
RE: Elections - by nacerr - Apr-21-2017, 09:19 AM
RE: Elections - by nacerr - Apr-21-2017, 01:40 PM
RE: Elections - by PythonHatesMe - Apr-25-2017, 06:24 AM
RE: Elections - by nacerr - Apr-25-2017, 06:27 AM
RE: Elections - by PythonHatesMe - Apr-25-2017, 06:40 AM
RE: Elections - by nacerr - Apr-25-2017, 06:43 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020