Hello, I need to leave a file tabbed, like this:
http://www.srl.caltech.edu/~shane/sensitivity/asteroids/scg_8564.dat Following piece of my code that does this: - with Django # ----------------------------- # Import # ----------------------------- from django.shortcuts import get_object_or_404, render_to_response from django.http import HttpResponseRedirect from django.http import HttpResponse from django.template import RequestContext from django.core.urlresolvers import reverse from simuladores.detector.forms import Fase from django.template import loader, Context from django.views.generic.simple import direct_to_template from django.forms import forms, fields from matplotlib import use use('Agg') from matplotlib.pyplot import plot, savefig, setp, figure, subplot import csv #from struct import pack from pylab import * import pylab from decimal import Decimal import math import matplotlib.pyplot as plt # ------------------------------------ # A view that to show the form # ------------------------------------ def desenha_grafico(request): if request.method == 'POST': form = Fase(request.POST) if form.is_valid(): f = xrange(3000,3400) # ------------ # S, Sfase # ------------ Sfase=[] for v in f: # --------------- # Sfase # --------------- Sfase.append(form.cleaned_data['Sph']*(pow(v,2)/ pow(form.cleaned_data['df'],2))) # --------------- # Plot Graph # --------------- fig = plt.figure() plt.subplots_adjust(hspace=0.4) plt.subplots_adjust(wspace=0.4) ax = plt.subplot(2,2,1) ax.plot(f,Sfase) leg = ax.legend(loc="left") setp(ax.get_xticklabels(), fontsize=8.5) setp(ax.get_yticklabels(), fontsize=8.5) frame = leg.get_frame() frame.set_facecolor('white') # set the frame face color to white # matplotlib.text.Text instances for t in leg.get_texts(): t.set_fontsize('9') grid('TRUE') savefig('C:\simuladores\detector\media\imagem.png') writer = csv.writer(open('C:\simuladores\detector\media \dados.dat','wb')) writer.writerow(f) writer.writerow(Sfase) resultado = Fase() # ----------------------------------- # return to template # ----------------------------------- return render_to_response('gera_grafico.html', {'resultado': resultado}, context_instance = RequestContext(request)) #return render_to_response('soma.html', {'resultado': resultado}) else: form = Fase(request.POST) return render_to_response('soma.html', {'form': form}) form=Fase() return render_to_response('soma.html', {'form': form}) Following my code in the IDLE of Python import numpy import pylab from pylab import * x = arange(3000,3400) y = -108*((x**2)/(3e14**2)) numpy.savetxt('C:\Documents and Settings\Web\dados.dat', (x,y)) However, my file dados.dat out as follows in this link, yhis out in a single line.... http://paste.pocoo.org/show/226192/ As I viewthis as link: http://www.srl.caltech.edu/~shane/sensitivity/asteroids/scg_8564.dat -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.