Hey,
On Thursday, 24 April 2014 20:23:29 UTC+5:30, Erik Cederstrand wrote:
-- Sorry to reply so late. I figured that thing out and i was able to send the results into a table successfully.
Thanks for the help :D
On Thursday, 24 April 2014 20:23:29 UTC+5:30, Erik Cederstrand wrote:
Den 24/04/2014 kl. 16.46 skrev Ravi Hemnani <raviii...@gmail.com>:
> def table(request):
> with open('/home/ravi/python/temp.txt', 'r') as f:
> for line in f:
> context = {'line': line}
Here you are ovwewriting 'content' on every iteration. When the loop exits, only the last line in the file will be in context. You want something like this instead:
def table(request):
with open('/home/ravi/python/temp.txt', 'r') as f:
context = {'lines': f.readlines()}
Erik
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/a35af90c-ae87-4f16-9cbb-cf37c793bb2c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment