[Tutor] HELP: Creating animation from multiple plots
Sayan Chatterjee
sayanchatterjee at gmail.com
Wed Mar 27 17:17:27 CET 2013
for t in range(0,200):
fname = 'file_' + str(t)
So it will assign fname values file_0, file_1 so on. Dropping the quotes is
giving me
IOError: [Errno 2] No such file or directory: 'file_0'
Indeed the file is not present. In C we write,if we have to record data in
a file
FILE *fp
fp = fopen("file.dat","w")
Here I want to write different data sets in files having different name i.e
I want to create the files with the data sets. I am quite new to Python, so
you can assume zero knowledge while answering. Thanks for your support. :)
On 27 March 2013 21:38, Walter Prins <wprins at gmail.com> wrote:
> Hello,
>
> On 27 March 2013 15:59, Sayan Chatterjee <sayanchatterjee at gmail.com>wrote:
>
>> Hi Amit,
>>
>> fo = fopen('fname','r+')
>> fo.write("%d %d",j,counter)
>>
>>
>> Is giving the following error:
>>
>> File "ZA.py", line 30, in <module>
>> fo = open('fname','r+')
>> IOError: [Errno 2] No such file or directory: 'fname'
>>
>> Where is the mistake?
>>
>
> You are trying to open a file named literally "fname" due to putting it in
> quotes, you probably want to drop the quotes.
>
> Walter
>
--
--------------------------------------------------------------------------
*Sayan Chatterjee*
Dept. of Physics and Meteorology
IIT Kharagpur
Lal Bahadur Shastry Hall of Residence
Room AB 205
Mob: +91 9874513565
blog: www.blissprofound.blogspot.com
Volunteer , Padakshep
www.padakshep.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20130327/b73c394f/attachment-0001.html>
More information about the Tutor
mailing list