Looked all over, but haven't found the answer. If I have a (windows) program
which I wish to start, even shell scripts, and possibly capture the output
from, how do I do that?
Thanks,
C
PS, also, please me to where I can find more. My searches were rather
useless.
Small problem:
Import zlib
For file in files:
checksum = zlib.adler32(file)
traceback
checksum = zlib.adler32(file)
TypeError: a bytes-like object is required, not 'str'
Obvious question, how do I make a bytes-like object. I've read through the
documentation and didn't find a way to do
-Original Message-
From: Tutor [mailto:tutor-bounces+crk=godblessthe...@python.org] On
Behalf Of Mark Lawrence
Sent: Saturday, August 15, 2015 4:05 PM
To: tutor@python.org
Subject: Re: [Tutor] variable existence q
On 15/08/2015 23:38, Clayton Kirkwood wrote:
top_directory
-Original Message-
From: Tutor [mailto:tutor-bounces+crk=godblessthe...@python.org] On
Behalf Of Laura Creighton
Sent: Saturday, August 15, 2015 2:49 PM
To: boB Stepp robertvst...@gmail.com
Cc: l...@openend.se; tutor tutor@python.org
Subject: Re: [Tutor] try and file existence
top_directory = /users/Clayton/Pictures
target_directory = top_directory #directory we are checking
filetypes = ('jpg', 'png', 'avi', 'mp4', 'mov', 'bmp')
imports...
def override_defaults():
with open( user_preferences ) as f:
for line in f.readline():
llist =
try:
fp = open( user_preferences )
except( PermissionError ):
else:
with open(user_preferences ) as f:
I originally only had the bottom open statement. Ran but file didn't exist,
and my run failed with file doesn't exist. I figured I'd check to see if the
file existed. This is one of
-Original Message-
From: Tutor [mailto:tutor-bounces+crk=godblessthe...@python.org] On
Behalf Of Peter Otten
Sent: Wednesday, August 12, 2015 2:22 AM
To: tutor@python.org
Subject: Re: [Tutor] a few question about my evolving program
Clayton Kirkwood wrote:
Look here
-Original Message-
From: Tutor [mailto:tutor-bounces+crk=godblessthe...@python.org] On
Behalf Of Alan Gauld
Sent: Wednesday, August 12, 2015 2:41 AM
To: tutor@python.org
Subject: Re: [Tutor] a few question about my evolving program
On 12/08/15 04:23, Clayton Kirkwood wrote
duplicated pictures in my picture directory
#Presumably, if the file exists in a subdirectory I can remove if from the
parent picture directory
#
#Clayton Kirkwood
#01Aug15
import os
from os.path import join, getsize, splitext
target_directory = /users/Clayton/Pictures #directory we are checking
-Original Message-
From: Cameron Simpson [mailto:c...@zip.com.au]
Sent: Tuesday, August 11, 2015 8:46 PM
To: Clayton Kirkwood c...@godblessthe.us
Cc: tutor@python.org
Subject: Re: [Tutor] a few question about my evolving program
On 11Aug2015 20:23, Clayton Kirkwood c
-Original Message-
From: Tutor [mailto:tutor-bounces+crk=godblessthe...@python.org] On
Behalf Of Mark Lawrence
Sent: Wednesday, August 05, 2015 3:23 PM
To: tutor@python.org
Subject: Re: [Tutor] Dictionary Issue
On 05/08/2015 15:15, Ltc Hotspot wrote:
Hi everyone:
I want to
As seen below (closely), some filenames are not being removed while others
are, such as in the first stanza, some pdfs are removed, some aren't. In the
second stanza, Thumbs.db makes it through, but was caught in the first
stanza. (Thanks for those who have proffered solutions to date!)
I see no
#Program to find duplicated pictures in my picture directory tree
#Presumably, if the file exists in a subdirectory I can remove if from the
parent picture directory
#
#Clayton Kirkwood
#01Aug15
import os
from os.path import join, getsize
main_dir = /users/Clayton/Pictures
directory_file_list
:
On 02/08/15 22:44, Clayton Kirkwood wrote:
for dir_path, directories, files in os.walk(main_dir):
for file in files:
#print( file = , file)
# if( ((\.jpg|\.png|\.avi|\.mp4)$) not in file.lower() ):
Python sees that as a single string. That string is not in your filename
-Original Message-
From: Tutor [mailto:tutor-bounces+crk=godblessthe...@python.org] On
Behalf Of Alan Gauld
Sent: Sunday, August 02, 2015 3:01 PM
To: tutor@python.org
Subject: Re: [Tutor] scratching my head
On 02/08/15 22:44, Clayton Kirkwood wrote:
for dir_path, directories
-Original Message-
From: Tutor [mailto:tutor-bounces+crk=godblessthe...@python.org] On
Behalf Of Steven D'Aprano
Sent: Sunday, August 02, 2015 5:49 PM
To: tutor@python.org
Subject: Re: [Tutor] scratching my head
On Sun, Aug 02, 2015 at 02:44:15PM -0700, Clayton Kirkwood wrote
-Original Message-
From: Tutor [mailto:tutor-bounces+crk=godblessthe...@python.org] On
Behalf Of Cameron Simpson
Sent: Sunday, August 02, 2015 6:03 PM
To: tutor@python.org
Subject: Re: [Tutor] scratching my head
On 02Aug2015 16:15, Clayton Kirkwood c...@godblessthe.us wrote
I was trying to pip install beautifulsoup and ran into the following error.
It appears to be 2.x because of the print. I am installing to a python
3.4.2. What do I need to do? I tried to log a bug report to PyPI Bug Reports
but that apparently isn't the cool thing to do. I can't perceive why the
-Original Message-
From: Tutor [mailto:tutor-bounces+crk=godblessthe...@python.org] On
Behalf Of Steven D'Aprano
Sent: Sunday, November 23, 2014 4:32 AM
To: tutor@python.org
Subject: Re: [Tutor] yes, I am being lazy...
On Sat, Nov 22, 2014 at 08:28:42PM -0800, Clayton Kirkwood wrote:
I
-Original Message-
From: Tutor [mailto:tutor-bounces+crk=godblessthe...@python.org] On
Behalf Of Walter Prins
Sent: Sunday, November 23, 2014 2:25 PM
Cc: python mail list
Subject: Re: [Tutor] yes, I am being lazy...
Hi,
On 23 November 2014 at 20:50, Clayton Kirkwood c...@godblessthe.us
-Original Message-
From: Tutor [mailto:tutor-bounces+crk=godblessthe...@python.org] On
Behalf Of Steven D'Aprano
Sent: Sunday, November 23, 2014 4:16 PM
To: tutor@python.org
Subject: Re: [Tutor] yes, I am being lazy...
On Sun, Nov 23, 2014 at 03:37:12PM -0800, Clayton Kirkwood wrote
I have had my first experience in downloading and trying to lay-in several
new modules. I downloaded requests and urllib3, unpacked them (on a windows
system) and extracted them from the zip. I don't understand how setup.py
and .cfg are supposed to implant them into the python hierarchy. The
Hi all.
Got a general problem with url work. I've struggled through a lot of code
which uses urllib.[parse,request]* and urllib2. First q: I read someplace in
urllib documentation which makes it sound like either urllib or urllib2
modules are being deprecated in 3.5. Don't know if it's only
-Original Message-
From: Joel Goldstick [mailto:joel.goldst...@gmail.com]
Sent: Friday, November 21, 2014 2:39 PM
To: Clayton Kirkwood
Cc: tutor@python.org
Subject: Re: [Tutor] urllib confusion
On Fri, Nov 21, 2014 at 4:37 PM, Clayton Kirkwood c...@godblessthe.us
wrote:
Hi all.
Got
3:24 PM
To: tutor@python.org
Subject: [Tutor] “has a value of True” versus “evaluates true” (was:
don't understand iteration)
Clayton Kirkwood c...@godblessthe.us writes:
Also of confusion, the library reference says:
Match objects always have a boolean value of True. Since match() and
search
...@benfinney.id.au
mailto:ben%2bpyt...@benfinney.id.au wrote:
Clayton Kirkwood c...@godblessthe.us writes:
So, there is a difference between None and False, is that the issue?
Yes. Those two values are different and not equal; but both evaluate
false in a boolean context.
Just to note
-Original Message-
From: Tutor [mailto:tutor-bounces+crk=godblessthe...@python.org] On
Behalf Of Alan Gauld
Sent: Monday, November 10, 2014 4:20 AM
To: tutor@python.org
Subject: Re: [Tutor] don't understand iteration
On 10/11/14 00:34, Clayton Kirkwood wrote:
if 'EST' in line or 'EDT
-Original Message-
From: Tutor [mailto:tutor-bounces+crk=godblessthe...@python.org] On
Behalf Of Ben Finney
Sent: Sunday, November 09, 2014 8:25 PM
To: tutor@python.org
Subject: Re: [Tutor] don't understand iteration
Clayton Kirkwood c...@godblessthe.us writes:
-Original Message
-Original Message-
From: Tutor [mailto:tutor-bounces+crk=godblessthe...@python.org] On
Behalf Of Alan Gauld
Sent: Monday, November 10, 2014 3:59 PM
To: tutor@python.org
Subject: Re: [Tutor] don't understand iteration
On 10/11/14 23:08, Clayton Kirkwood wrote:
I couldn't find a way
of True” versus “evaluates true” (was:
don't understand iteration)
Clayton Kirkwood c...@godblessthe.us writes:
Also of confusion, the library reference says:
Match objects always have a boolean value of True. Since match() and
search() return None when there is no match, you can test whether
-Original Message-
From: Tutor [mailto:tutor-bounces+crk=godblessthe...@python.org] On
Behalf Of Ben Finney
Sent: Sunday, November 09, 2014 8:25 PM
To: tutor@python.org
Subject: Re: [Tutor] don't understand iteration
Clayton Kirkwood c...@godblessthe.us writes:
-Original Message
-Original Message-
From: Tutor [mailto:tutor-bounces+crk=godblessthe...@python.org] On
Behalf Of Alan Gauld
Sent: Monday, November 10, 2014 5:07 PM
To: tutor@python.org
Subject: Re: [Tutor] don't understand iteration
On 11/11/14 00:28, Clayton Kirkwood wrote:
This seems
-Original Message-
From: Tutor [mailto:tutor-bounces+crk=godblessthe...@python.org] On
Behalf Of Steven D'Aprano
Sent: Sunday, November 09, 2014 3:04 AM
To: tutor@python.org
Subject: Re: [Tutor] http question
On Sat, Nov 08, 2014 at 09:53:33PM -0800, Clayton Kirkwood wrote:
but I
I have the following code:
import urllib.request,re,string
months = ['Jan.', 'Feb.', 'Mar.', 'Apr.', 'May.', 'Jun.', 'Jul.', 'Aug.',
'Sep.', 'Oct.', 'Nov.', 'Dec.']
from urllib.request import urlopen
for line in urlopen('http://tycho.usno.navy.mil/cgi-bin/timer.pl'):
line =
-Original Message-
From: Tutor [mailto:tutor-bounces+crk=godblessthe...@python.org] On
Behalf Of Dave Angel
Sent: Sunday, November 09, 2014 5:10 PM
To: tutor@python.org
Subject: Re: [Tutor] don't understand iteration
You forgot to state your Python version. I'll assume 3.4
Clayton
-Original Message-
From: Tutor [mailto:tutor-bounces+crk=godblessthe...@python.org] On
Behalf Of Peter Otten
Sent: Sunday, November 09, 2014 5:47 PM
To: tutor@python.org
Subject: Re: [Tutor] don't understand iteration
Clayton Kirkwood wrote:
I have the following code:
blah
As I move through my learning process, I am wanting to do some http posts,
etc. I know that there is a http class, but I also am aware of httplib2, but
it still seems to be in eternal alpha. Which would be better? (However you
want to define better)
TIA,
Clayton
You can tell the
-Original Message-
From: Tutor [mailto:tutor-bounces+crk=godblessthe...@python.org] On
Behalf Of Steven D'Aprano
Sent: Saturday, November 08, 2014 9:14 PM
To: tutor@python.org
Subject: Re: [Tutor] http question
On Sat, Nov 08, 2014 at 06:12:48PM -0800, Clayton Kirkwood wrote:
As I move
-Original Message-
From: Tutor [mailto:tutor-bounces+crk=godblessthe...@python.org] On
Behalf Of Alan Gauld
Sent: Sunday, November 02, 2014 1:04 AM
To: tutor@python.org
Subject: Re: [Tutor] all right students, what do we learn
On 02/11/14 05:43, Clayton Kirkwood wrote:
So I head down
-Original Message-
From: Tutor [mailto:tutor-bounces+crk=godblessthe...@python.org] On
Behalf Of Dave Angel
Sent: Sunday, November 02, 2014 1:18 AM
To: tutor@python.org
Subject: Re: [Tutor] all right students, what do we learn
On 11/02/2014 01:43 AM, Clayton Kirkwood wrote:
To prove
To prove that a little knowledge is a little stupid or something to that
effect:
#for key in key_list:
#print(key)
#if key not in key_list0:
#print(Error:, key, not available, start again)
#get_new_list = True
#break
#else:
-Original Message-
From: Tutor [mailto:tutor-bounces+crk=godblessthe...@python.org] On
Behalf Of Dave Angel
Sent: Wednesday, October 29, 2014 5:30 AM
To: tutor@python.org
Subject: Re: [Tutor] Would somebody kindly...
Clayton Kirkwood c...@godblessthe.us Wrote in message
Explain this double speak(:
[pair for pair in values if key == pair[0]]
I understand the 'for pair in values'. I assume the first 'pair' creates the
namespace (although I am not sure how Python knows it's a tuple yet). I
think the outer [] make the line a comprehension ( If so, I don't seem
...@hashcollision.org]
!Sent: Tuesday, October 28, 2014 4:23 PM
!To: Clayton Kirkwood
!Cc: Python Tutor Mailing List
!Subject: Re: [Tutor] Would somebody kindly...
!
!On Tue, Oct 28, 2014 at 4:13 PM, Clayton Kirkwood c...@godblessthe.us
!wrote:
! Explain this double speak(:
!
! [pair for pair in values
!-Original Message-
!From: Tutor [mailto:tutor-bounces+crk=godblessthe...@python.org] On
!Behalf Of Alan Gauld
!Sent: Sunday, October 26, 2014 5:34 PM
!To: tutor@python.org
!Subject: Re: [Tutor] if you're interested in the code thus far...
!
!On 26/10/14 22:12, Clayton Kirkwood wrote
__author__ = 'SYSTEM'
import string
#PricingDividends
raw_table = ('''
a: Asky: Dividend Yield
b: Bid d: Dividend per Share
b2: Ask (Realtime) r1: Dividend Pay Date
b3: Bid (Realtime)q: Ex-Dividend Date
p: Previous Close
o: Open
Date
c1:
Good eyes on the logic
!-Original Message-
!From: Tutor [mailto:tutor-bounces+crk=godblessthe...@python.org] On
!Behalf Of Peter Otten
!Sent: Sunday, October 26, 2014 3:53 AM
!To: tutor@python.org
!Subject: Re: [Tutor] if you're interested in the code thus far...
!
!Clayton Kirkwood
!-Original Message-
!From: Tutor [mailto:tutor-bounces+crk=godblessthe...@python.org] On
!Behalf Of Alan Gauld
!Sent: Sunday, October 26, 2014 2:11 AM
!To: tutor@python.org
!Subject: Re: [Tutor] if you're interested in the code thus far...
!
!On 25/10/14 23:46, Clayton Kirkwood wrote
description_string=code_string=''
description = code = 'a'
for (description_position, code_position) in (description, code):
print(description_position,code_position)
I have tried variations on this for statement, and it doesn't work:))) Both
description and code have the same size
!-Original Message-
!From: Tutor [mailto:tutor-bounces+crk=godblessthe...@python.org] On
!Behalf Of Peter Otten
!Sent: Saturday, October 25, 2014 4:41 AM
!To: tutor@python.org
!Subject: Re: [Tutor] solution for for loop?
!
!Clayton Kirkwood wrote:
!
! description_string=code_string
, Clayton Kirkwood wrote:
!
! col_position, code, description = 0, [], [] key_name =
! raw_table.replace('\t','\n') for each_line in key_name.splitlines():
! if ':' in each_line:
!code[col_position], description.append() =
! each_line.split(':') #neither works; first one is out of range
As I've contemplated the usage of dictionaries, I face the question of
efficiency. Going back before most of you were probably born;)) if I
remember correctly dictionaries(assoc. arrays), having hashes, are efficient
for storing sparse arrays with the added benefit of hiding the traversal of
the
__author__ = 'SYSTEM'
import string
#PricingDividends
raw_table = ('''
a: Asky: Dividend Yield
b: Bid d: Dividend per Share
b2: Ask (Realtime) r1: Dividend Pay Date
b3: Bid (Realtime)q: Ex-Dividend Date
p: Previous Close
o: Open
import re,
, Clayton Kirkwood wrote:
!
! As I've contemplated the usage of dictionaries, I face the question of
! efficiency. Going back before most of you were probably born;)) if I
! remember correctly dictionaries(assoc. arrays), having hashes, are
! efficient for storing sparse arrays with the added benefit
Thanks all for the insight. I'm not sure I fully understand all of the code
snippets, but in time...
This is finally what I came up with:
raw_table = ('''
a: Ask y: Dividend Yield
b: Bid d: Dividend per Share
b2: Ask (Realtime) r1: Dividend Pay Date
b3: Bid (Realtime) q: Ex-Dividend
raw_table = ('''
a: Asky: Dividend Yield
b: Bid d: Dividend per Share
b2: Ask (Realtime) r1: Dividend Pay Date
b3: Bid (Realtime)q: Ex-Dividend Date
p: Previous Close
o: Open''')
key_name = raw_table.rstrip('\t')
print(key_name)
a: Asky: Dividend
No, it hasn't taken the whole time, but it did take longer than I wanted,
but I did progress as seen below.
1st pass - get the idea down:
#program to capture streaming quotes from yahoo
import re
out_file = open(output, mode='w')
in_file = open('Yahoo!_Finance_Portfolios.htm', encoding=
I was trying to keep it generic.
Wrapped data file:
tr data-row-symbol=SWKStd class=col-symbol txtspan
class=wrapper data-model=name:DatumModel;id:null; data-tmpl=a
data-ylk=cat:portfolio;cpos:1 href=http://finance.yahoo.com/q?s=SWKS;
data-rapid_p=18SWKS/a/span/tdtd
!-Original Message-
!From: Tutor [mailto:tutor-bounces+crk=godblessthe...@python.org] On
!Behalf Of Peter Otten
!Sent: Tuesday, October 07, 2014 3:50 AM
!To: tutor@python.org
!Subject: Re: [Tutor] search/match file position q
!
!Clayton Kirkwood wrote:
!
! I was trying to keep it generic
!
! So, what makes regex wrong for this job?
!
!A regex doesn't understand the structure of an html document. For
!example
!you need to keep track of the nesting level manually to find the cells
!of
!the inner of two nested tables.
!
! question still remains: does the
! search start at the
!-Original Message-
!From: Danny Yoo [mailto:d...@hashcollision.org]
!Sent: Tuesday, October 07, 2014 11:14 AM
!To: Clayton Kirkwood
!Cc: Python Tutor Mailing List
!Subject: Re: [Tutor] search/match file position q
!
! So, what makes regex wrong for this job? question still remains: does
Here's my problem; my code snippet reads a file(presumably an _io.readline,
I'll question this later), with the file.readline(). The output shows
individual characters being read and printed out followed by the here
being printed. Also, see below.
Source data file:
!-- saved from
Howdy
I haven't been able to find an definitive answer. I am looking through a
file(stream:), for several matching strings. Match definitively starts at
the beginning of the stream. As I search, or match, do I start over at the
beginning of the stream for each match or do I start at the end of
-0700, Clayton Kirkwood wrote:
!
! # program to test time and count options
!
! import datetime,operator, sys
! from datetime import time, date, datetime date = datetime.now()
! dayofweek = date.strftime(%a, %b) print(Today is, dayofweek,
! date.day, at , date.time())
!
! start = 0
! count_max=int
!-Original Message-
!From: Danny Yoo [mailto:d...@hashcollision.org]
!Sent: Wednesday, October 01, 2014 12:11 AM
!To: Clayton Kirkwood
!Cc: Python Tutor Mailing List
!Subject: Re: [Tutor] could somebody please explain...
!
! Also, I found something that I can’t get my mind around
question in a separate
!email.)
!
The part in question is the date components in the parentheses of the first
datetime.
Clayton Kirkwood
!
!
!--
!Steven
!___
!Tutor maillist - Tutor@python.org
!To unsubscribe or change subscription options:
!https
I don't understand the multiplicity of some tools. Namely, why is there a
'a+b', operator.add(a,b), operator.__add__(a,b), operator.iadd(a,b),
operator.__iadd__(a,b) and their related operators?
Also, I found something that I can't get my mind around. It is part of the
time/date protocols.
I'm ramping slowly unfortunately. How does one go about knowing which module
to import to make certain functions work? I have a read() that fails because
there is no definition for it. I am using the Wing IDE. I have traversed
much of the developer's guide and can't find any certainty.
68 matches
Mail list logo