On Sun, Dec 28, 2008 at 5:36 PM, H. S. Rai <hardeep....@gmail.com> wrote:
>
> What is the easiest way to read data from file. file function mention
> of size, I want to read variable wise, like:
>
> f.read(myInteger1, myFloat1, myString1)
>
> My data file will be:
> 'b' 'breadth of member' 250
> 'D' 'overall depth of member' 550
>
> Each line having three entries: <variable name>,<Description>,<Default vaule>
>
> These may be separated by comma, tab or space. If I am able to read
> and have list like:
>
> varList[ [ 'b', 'breadth of member', 250 ] , [ 'D', 'overall depth of
> member', 550  ]  ]
>
> then that will serve my purpose.
>

Please send another email with a short example file attached, which is
*exactly* like the file you want to read in. I'm sure somebody will
respond with a snippet of code to do what you want.

The code will likely look like

 varList = [x.replace(',',' ').split() for x in open('file').readlines()]

William

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to