Re: [Tutor] subprocess outputing wrong info to command line

2015-02-20 Thread Steven D'Aprano
On Fri, Feb 20, 2015 at 06:58:17PM -0500, brads wrote: > My subprocess is in error but the same command at the command line works > fine. Are you running the Python script as the same user and from the same location as the command line? If you are running the Python script as an unprivileged us

Re: [Tutor] updating a dictionary

2015-02-20 Thread Danny Yoo
On Fri, Feb 20, 2015 at 3:47 PM, Chris Stinemetz wrote: > > I understand what you are explaining to me but I am not sure why every > instance of the key 8:value changes when I assign a new value to it. Ah. Be wary of structure sharing when the values being shared are mutable. A textbook examp

Re: [Tutor] updating a dictionary

2015-02-20 Thread Chris Stinemetz
On Fri, Feb 20, 2015 at 4:51 PM, Mark Lawrence wrote: > On 20/02/2015 17:56, Chris Stinemetz wrote: > > Please don't top post as it makes long threads difficult if not impossible > to follow, thanks. > > I am getting closer. I think I have figured out the logic. I just have a >> quick question.

[Tutor] subprocess outputing wrong info to command line

2015-02-20 Thread brads
My subprocess is in error but the same command at the command line works fine. # cat makekeys.py #!/usr/bin/python3.4 import subprocess import sys import string import os.path import datetime import shlex from time import gmtime, strftime from subprocess import Popen, PIPE, STDOUT

Re: [Tutor] updating a dictionary

2015-02-20 Thread Mark Lawrence
On 20/02/2015 17:56, Chris Stinemetz wrote: Please don't top post as it makes long threads difficult if not impossible to follow, thanks. I am getting closer. I think I have figured out the logic. I just have a quick question. How do you access key:values in a nested dictionary? MOL02997_C':

Re: [Tutor] updating a dictionary

2015-02-20 Thread Alan Gauld
On 20/02/15 17:56, Chris Stinemetz wrote: I am getting closer. I think I have figured out the logic. I just have a quick question. How do you access key:values in a nested dictionary? MOL02997_C': [{'2': '0', '7': '0', '8': '0', '9': '0'}]} say I want to access the key:value 8:0 print dict['MO

Re: [Tutor] updating a dictionary

2015-02-20 Thread Chris Stinemetz
I am getting closer. I think I have figured out the logic. I just have a quick question. How do you access key:values in a nested dictionary? MOL02997_C': [{'2': '0', '7': '0', '8': '0', '9': '0'}]} say I want to access the key:value 8:0 print dict['MOL02997_C']['8'] doesn't seem to work. Thank

Re: [Tutor] Issue in date difference in Python 2.7.8

2015-02-20 Thread Dave Angel
On 02/20/2015 04:28 AM, Puruganti Ramesh wrote: Hi Friends, I have an issue in comparing dates in python 2.7.8 I have written code as below but i am getting error Code is : import datetime as dt from datetime import datetime from datetime import datetime, timedelta, date dt_str='2014-5-11' dt_s

Re: [Tutor] Issue in date difference in Python 2.7.8

2015-02-20 Thread Peter Otten
Puruganti Ramesh wrote: > Hi Friends, > > I have an issue in comparing dates in python 2.7.8 > I have written code as below but i am getting error > Code is : > import datetime as dt > from datetime import datetime > from datetime import datetime, timedelta, date > > dt_str='2014-5-11' > dt_strq

[Tutor] Issue in date difference in Python 2.7.8

2015-02-20 Thread Puruganti Ramesh
Hi Friends, I have an issue in comparing dates in python 2.7.8 I have written code as below but i am getting error Code is : import datetime as dt from datetime import datetime from datetime import datetime, timedelta, date dt_str='2014-5-11' dt_strq='2014-9-11' dt_datea = datetime.strptime(dt_s

Re: [Tutor] updating a dictionary

2015-02-20 Thread Peter Otten
Chris Stinemetz wrote: > ​Here is a sample of the input data, it is tab delimited and I chopped it > down for example purposes: > ​ > > KSL03502_7A_1 11.5921 > KSL03502_7B_1 46.4997 > KSL03502_7C_1 13.5839 > KSL03505_7A_1 12.8684 > KSL03505_7B_1 16.5311 > KSL03505_7C_1 18.9926 > KSL03509_7A_1 3.

Re: [Tutor] python script

2015-02-20 Thread Mark Lawrence
On 20/02/2015 03:56, rohit poddaturi wrote: Hi I am really new to python and have been given a assignment which is quite complex for my standard.The following is the assignment The program runs through the word document and when it sees a date ( the date might be in a variety of forms, but w

Re: [Tutor] python script

2015-02-20 Thread Alan Gauld
On 20/02/15 03:56, rohit poddaturi wrote: The program runs through the word document and when it sees a date > ( the date might be in a variety of forms, but will always list the particular month) > it goes to a new row in the excel sheet and lists that date. OK, The first question that sp

[Tutor] python script

2015-02-20 Thread rohit poddaturi
Hi I am really new to python and have been given a assignment which is quite complex for my standard.The following is the assignment The program runs through the word document and when it sees a date ( the date might be in a variety of forms, but will always list the particular month) it go