"John Bausano" <[EMAIL PROTECTED]> wrote: > >Hello all, > >I've been using Ansys which is a commercial FEA package which can be >controlled through its own scripting language they call APDL. Now I'm >trying to write some stand alone code in Python to supplement my current >efforts. > >In Ansys I can do something like this. > >*do,n,1,3 #loop through n > > *dim,data%n%,1000,2 #creates variables >arrays data1(1000,2), data2(1000,2).. > > *vread,data%n%,filename%n% #fills arrays with data >from filename1,.
Generally, you need to think about your problem in a slightly different way. Instead of thinking about creating variables called data1 and data2, think about creating a dictionary called "data" which contains three elements. For example: data = {} for n in range(3): data[n] = read_from( 'filename%d' % n ) It IS possible to create variables on the fly, but except in very special situations, it is almost never the right way to do things. -- - Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list