How to add data in xlm file ?

Asad ur Rehman asadurrehman319 at gmail.com
Sat Aug 13 05:05:48 EDT 2016


def Test(request):

    save_path = '/usr/share/newfies/'

    name_of_file = ("Avatar")

    completeName = os.path.join(save_path, name_of_file+".xlm")         

    file1 = open(completeName, "w")

    toFile = raw_input("Write what you want into the field")

    file1.write(toFile)

    file1.close()

This is code for save file in specific directory.Output of this file is empty i want to get data from database i write database query in it but it did't work.Example\

def Test(request):

    save_path = '/usr/share/newfies/'

    name_of_file = ("Avatar")

    completeName = os.path.join(save_path, name_of_file+".xlm")         

    file1 = open(completeName, "w")

    toFile = Subscriber.objects.all().count()

    file1.write(toFile)

    file1.close()


Subscriber is table name in my database.

How can i get data ?
Thanks in advance !



More information about the Python-list mailing list