Thank you Ramit. I updated my code since I am running 2.7.1+ on Ubuntu.
Best wishes,
Mina
On 11-10-25 08:02 AM, Prasad, Ramit wrote:
f = open(args.fname, 'r')
lines = f.readlines()
f.close()
If you are using Python 2.6+ you can use a context manager to automatically
close the file. That way
>f = open(args.fname, 'r')
>lines = f.readlines()
>f.close()
If you are using Python 2.6+ you can use a context manager to automatically
close the file. That way you never have to worry about closing any files!
with open(args.fname, 'r') as f:
lines = f.readlines()
Ramit
Ramit Prasad | J
Hi Marc,
Thank you. Following some of your suggestion, the rewrite below worked. I agree with your point on readability over
complexity. By grace I meant not convoluted or simpler. That's all. As a beginner, I find not knowing all the
existing functions, I end up re-inventing the wheel som
On Wed, Oct 19, 2011 at 12:06 PM, Marc Tompkins wrote:
> This approach also works in the event that the data wasn't all collected in
> order - i.e. there might be data for Ag111 followed by U235 followed by
> Ag111 again.
>
> Ahem... Of course, I meant "Ag47 followed by U235 followed by Ag47
agai
On Wed, Oct 5, 2011 at 11:12 AM, Mina Nozar wrote:
> Now, I would like to parse through this code and fill out 3 lists: 1)
> activity_time, 2) activity, 3) error, and plot the activities as a function
> of time using matplotlip. My question specifically is on how to parse
> through the lines con
Hello Wayne,
Thank you for your help and sorry for the delay in the response. I was caught up with other simulation jobs and didn't
get around to testing what you suggested until yesterday.
On 11-10-05 01:24 PM, Wayne Werner wrote:
On Wed, Oct 5, 2011 at 1:12 PM, Mina Nozar mailto:noz...@tri
On Wed, Oct 5, 2011 at 1:12 PM, Mina Nozar wrote:
>
> If there is a more graceful way of doing this, please let me know as well.
> I am new to python...
>
I just glanced through your email, but my initial thought would be to just
use regex to collect the entire segment that you're looking for