Hi I just started learning programming and tried some looping with file management. I am not sure how to join the string after looping can someone give me some pointers how can i go about doing it? Thanks!

This is my code

import string

testFile = open("test.txt", "r").readlines()

for line in inFile:
    for word in line.split():
        line = word.capitalize()
        print line

It's not obvious what you want to do. If you want to capitalize the first word of the sentence:

test_recs = "The quick brown fox jumped over the lazy dog.  test sentence number two."
new_rec_list=[]
for sentence in test_recs.split(". "):
    if len(sentence):
        new_sentence = sentence.strip().capitalize()
        new_rec_list.append(new_sentence)
print ". ".join(new_rec_list)

Be careful with capitalize method:

>>> 'notice: Tony Veijalainen posts to DaniWeb'.capitalize()
'Notice: tony veijalainen posts to daniweb'
>>> 'notice: Tony Veijalainen posts to DaniWeb'.title()
'Notice: Tony Veijalainen Posts To Daniweb'