On 12Oct2015 21:21, Crusier wrote:
I am using Python 3.4. I am trying to do some web scraping at this moment.
I got stuck because there is an IndexError: list index out of range if I
put stock_code = (18). My desire output is that the script is able to
detect print out the recent price whether i
Hi
I am using Python 3.4. I am trying to do some web scraping at this moment.
I got stuck because there is an IndexError: list index out of range if I
put stock_code = (18). My desire output is that the script is able to
detect print out the recent price whether it is up, down or unchanged.
Attac
On 13/10/15 00:32, Nym City wrote:
ans=raw_input("What would you like to do? ")
if ans=="1":
locality = raw_input("\nEnter City ")
break
elif ans=="2":
region = raw_input("\n Search by State ")
break
elif ans=="3":
zip = raw_input("\n Search by Zip
On 13Oct2015 10:37, Steven D'Aprano wrote:
On Mon, Oct 12, 2015 at 02:55:43PM +, David Aldrich wrote:
Consider a 'send' method that sends a message to another system via a
socket. This method will wait for a response before returning. There
are two possible error conditions:
[...]
So, m
Thank you for your response. I updated the first portion of my code to include
breaks:
import urllib2
import json
locu_api = 'redacted'
ans=True
while ans:
print ("""
1.Search by City
2.Search by Region (State Abbreviation)
3.Search by Zip
4.Exit/Quit
""")
ans=raw_i
On Mon, Oct 12, 2015 at 02:55:43PM +, David Aldrich wrote:
> Hi
>
> Consider a 'send' method that sends a message to another system via a
> socket. This method will wait for a response before returning. There
> are two possible error conditions:
[...]
> So, my question is, what's the pytho
On Mon, Oct 12, 2015 at 10:37:51AM -0700, Alex Kleider wrote:
> Any comments about when/if to use 'if src != None:' vs 'if src is not
> None:'?
> (or 'if src == None:' vs 'if src is None:')
Short answer: always compare to None using `is` or `is not`.
Long answer:
If you want to check for src b
Alex Kleider writes:
> Any comments about when/if to use 'if src != None:' vs 'if src is not
> None:'?
Express your intention in the code.
If you want to express “is this value the ‘None’ singleton?”, compare
identity with ‘is’/‘is not’. (This is what you almost always mean when
comparing to ‘N
On Mon, 12 Oct 2015 17:15 Albert-Jan Roskam wrote:
Hi,
In Python 2 one can do silly apple-pear comparisons such as 0> "0".*)
"CPython implementation detail: Objects of different types except numbers
are ordered by their type names; objects of the same types that don’t
support proper comparison a
> To: tutor@python.org
> From: em...@fenx.com
> Date: Mon, 12 Oct 2015 09:25:00 -0700
> Subject: Re: [Tutor] 0> "0" --> is there a "from __future__ import to make
> this raise a TypeError?
>
> On 10/12/2015 9:12 AM, Albert-Jan Roskam wrote:
>> Hi,
>>
>>
>
Hi
Consider a 'send' method that sends a message to another system via a socket.
This method will wait for a response before returning. There are two possible
error conditions:
1) Timeout - i.e. no response received
2) Illegal response received
I need to communicate these errors
> data = array.array("i", inf.read())
Thanks for all the answers to my question. I used the array method in the end.
Best regards
David
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mail
On 12/10/15 05:15, Fast Primes wrote:
If so, could someone present an example?
Yes, and Emile has shown how for a trivial, pure
binary case.
But to make the catenation sensible you need to know
the file type. Many media files hold the actual media
data inside an envelope of header information
On 2015-10-11 14:52, Cameron Simpson wrote:
Minor remark: I would write "if src is not None:". In principle the
empty string is also "falsey" like None, making your plain "if src:"
slightly unreliable. Be precise!
'precise' is good!
Any comments about when/if to use 'if src != None:' vs 'if s
On 10/12/2015 9:12 AM, Albert-Jan Roskam wrote:
Hi,
In Python 2 one can do silly apple-pear comparisons such as 0> "0".*) "CPython
implementation detail: Objects of different types except numbers are ordered by their type names;
objects of the same types that don’t support proper comparison a
Hi,
In Python 2 one can do silly apple-pear comparisons such as 0> "0".*) "CPython
implementation detail: Objects of different types except numbers are ordered by
their type names; objects of the same types that don’t support proper
comparison are ordered by their address.". In Python3 this h
On 10/11/2015 9:15 PM, Fast Primes wrote:
If so, could someone present an example?
target = open(target,'wb')
for source in mediafilelist:
target.write(open(source,'rb').read())
But you probably want something different anyway.
Emile
___
Tu
17 matches
Mail list logo