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 th
> -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
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 = line.
> -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
> Cc: l...@openend.se; tutor
> Subject: Re: [Tutor] try and file existence
>
> In a message of Sat, 15 Aug 20
10 top_directory = "/users/Clayton/Pictures"
def override_defaults():
56 return( top_directory, filetypes, target_directory )
80 top_directory, filetypes, target_directory = override_defaults()
File "C:/Users/Clayton/python/find picture duplicates/find picture
duplicates", line 8
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 those
e, Aug 11, 2015 at 08:23:00PM -0700, Clayton Kirkwood wrote:
>
> > Question 2:
> > My current code:
> > See "Look here" below.
>
>
> There's an art to picking good variable names, neither too short nor too
long,
> just descriptive enough withou
> -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
> -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 Kirkwo
> -Original Message-
> From: Cameron Simpson [mailto:c...@zip.com.au]
> Sent: Tuesday, August 11, 2015 8:46 PM
> To: Clayton Kirkwood
> Cc: tutor@python.org
> Subject: Re: [Tutor] a few question about my evolving program
>
> On 11Aug2015 20:23, Clayton Kirkwo
Program to find 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" #
> -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:
> >
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 lo
In a former life, I played the part of a system manager in a number of Unix
environments, which I really liked. Now, I am stuck using Windows and don't
get into the innards much. I ran into a problem in my program, which we have
been discussing, which is windows-caused. I originally set my director
> -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
> -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 Kirkwoo
te:
> >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.lowe
> -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 wr
ayton
#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"
dire
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
te
>-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
>-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 2
>-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
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 insta
>-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
>wrote:
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 par
%2bpyt...@benfinney.id.au> > wrote:
"Clayton Kirkwood" 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; not all programming langu
>Sent: Monday, November 10, 2014 3:24 PM
>To: tutor@python.org
>Subject: [Tutor] “has a value of True” versus “evaluates true” (was:
>don't understand iteration)
>
>"Clayton Kirkwood" writes:
>
>> Also of confusion, the library reference says:
>>
&
>-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
>-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 Kirk
>-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&quo
Subject: [Tutor] “has a value of True” versus “evaluates true” (was:
>don't understand iteration)
>
>"Clayton Kirkwood" writes:
>
>> Also of confusion, the library reference says:
>>
>> Match objects always have a boolean value of True. Since match(
>-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 Kirk
>-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&quo
>-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 Kirk
>-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:
&
thon version. I'll assume 3.4
>
>"Clayton Kirkwood" Wrote in message:
>> I have the following code: import urllib.request,re,stringmonths =
>['Jan.', 'Feb.', 'Mar.', 'Apr.', 'May.', 'Jun.', 'Jul.', &
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 = line.decode(
>-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
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 caliber
>-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
>-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 K
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: get_
>-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" Wrote i
!-Original Message-
!From: Tutor [mailto:tutor-bounces+crk=godblessthe...@python.org] On
!Behalf Of Dave Angel
!Sent: Tuesday, October 28, 2014 6:34 PM
!To: tutor@python.org
!Subject: Re: [Tutor] Would somebody kindly...
!
!
!>
! Explain this double speak(>:
!> [pair for pair in values i
!-Original Message-
!From: Cameron Simpson [mailto:c...@zip.com.au]
!Sent: Tuesday, October 28, 2014 6:31 PM
!To: Clayton Kirkwood
!Cc: 'Danny Yoo'; 'Python Tutor Mailing List'
!Subject: Re: [Tutor] Would somebody kindly...
!
!On 28Oct2014 18:02, Clayton Kirkwood
...@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
!wrote:
!> Explain this double speak(>:
!>
!> [pair for pair in values if k
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 t
!-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
!-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
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 Kir
__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: Chan
!-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_str
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 arra
-0700, 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_l
-0700, 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 spa
__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,
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 d
!-Original Message-
!From: Tutor [mailto:tutor-bounces+crk=godblessthe...@python.org] On
!Behalf Of Dave Angel
!Sent: Tuesday, October 21, 2014 6:51 AM
!To: tutor@python.org
!Subject: Re: [Tutor] what am I not understanding?
!
!"Clayton Kirkwood" Wrote in message:
!> Thank
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 D
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 Yie
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= "
!-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 rema
!>
!> 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 beg
!-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
I was trying to keep it generic.
Wrapped data file:
http://finance.yahoo.com/q?s=SWKS";
data-rapid_p="18">SWKS23.27', line_in)
#scan to SWKS"> in data
#line, stock sh
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 th
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:
html class="yui3-js-e
, 2014 at 09:43:29AM -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", dayo
!-Original Message-
!From: Tutor [mailto:tutor-bounces+crk=godblessthe...@python.org] On
!Behalf Of Steven D'Aprano
!Sent: Tuesday, September 30, 2014 6:38 PM
!To: tutor@python.org
!Subject: Re: [Tutor] could somebody please explain...
!
!On Tue, Sep 30, 2014 at 03:54:42PM -0700, Cl
actions.Fraction
!
!etc.
!
!
!(P.S. it is better to raise each independent 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 - Tut
!-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. It
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've
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.
Secondar
75 matches
Mail list logo