On 28 Apr 2013, at 17:13 , François Schiettecatte <[email protected]>
wrote:
> sys.stdin is an iterator not a list so addressing an element in the way you
> are doing it won't work, you would need to wrap sys.stdin in a list() to
> cause it to read all the lines, and then address the element, for example
I knew I was going to hate python, and I do. My script was failing because
there were spaces indenting a line instead of a tab.
I finally, after much struggling, ended up with this:
#!/usr/bin/python
import sys
import datetime
import re
for line in sys.stdin:
line=line.strip()
myDate, myPath = line.split(' ',1)
myDate = str(datetime.date.fromordinal(int(myDate)))
myDate = re.sub('[^\d]','',myDate)
print 'touch -ct {}0001 {}'.format(myDate,myPath)
Thank you all for your help.
Now, one other thing, if I wanted to execute the touch command (I don't, in
this case), could I do that within the python via some sort of exec() function?
--
"@Drhorrible is not following you" Whew! that's a relief, I was sure
some super villain was following me. Hope it's not Dick Cheney.
--
--
You received this message because you are subscribed to the
"BBEdit Talk" discussion group on Google Groups.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
<http://groups.google.com/group/bbedit?hl=en>
If you have a feature request or would like to report a problem,
please email "[email protected]" rather than posting to the group.
Follow @bbedit on Twitter: <http://www.twitter.com/bbedit>
---
You received this message because you are subscribed to the Google Groups
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.