#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2012
    Posts
    6
    Rep Power
    0

    *Number of Names*


    assume that a file containing a series of names (as strings) is named names.txt and exists on the computer's disk. Write a program that displays the number of names that are stored in the file. (Hint: Open the file and read every string stored in it. Use a Variable to keep a count of the number of items that are read from the file.)
  2. #2
  3. Contributing User
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Aug 2011
    Posts
    4,995
    Rep Power
    481
    import os
    print(os.popen('wc -l names.txt','r').read())
    [code]Code tags[/code] are essential for python code and Makefiles!

IMN logo majestic logo threadwatch logo seochat tools logo