ubscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
That's not how you run files.
python path-to-your-file
If it isn't in your %PATH% (it might not be, as you need to set it in
Computer->Properties->Advanced system settings->Environment
Variables), prepend
> 'USER': '',
> 'PASSWORD': '12424214',
> 'HOST': 'mongodb://staff.mongohq.com/',
> 'PORT': 'X',
> },
> }
>
> my requirement packages,
> Django==1.3
> dictshield==0
ommended that you use the
> Python 2.7 runtime. This tutorial is for the older version of the Python
> runtime that lacks many of the newer App Engine features.
From your link.
--
Kwpolska <http://kwpolska.tk>
stop html mail | always bottom-post
www.asciiribbon.org | www.netmeis
>
> [snip]
Why not the more standard:
import sys
import os
and so on? http://www.python.org/dev/peps/pep-0008/#imports
--
Kwpolska <http://kwpolska.tk>
stop html mail | always bottom-post
www.asciiribbon.org | www.netmeister.org/news/learn2quote.htm
html
Also, using registry keys is not a great idea if you would want
someone to use your code on a different platform.
(originally sent to the OP @ 2012-08-03T15:14:00Z)
--
Kwpolska <http://kwpolska.tk>
stop html mail | always bottom-post
www
lar nowadays), but it costs
$199.99. But you also need to pay the iPhone Developer fee of $99.
And, of course, you need a Mac, no matter what. Thus, it’s cheaper to
learn and write in Objective-C. Or for Android.
--
Kwpolska <http://kwpolska.tk>
stop html mail | always bottom-pos
e subscription options:
>> http://mail.python.org/mailman/listinfo/tutor
> ___
> Tutor maillist - Tutor@python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
Sure, the website can be written using
ld pass at least five grand by now.
And sorry for a bit of OT, but I had to.
* Android and Nokia/Ovi are per lifetime AFAIK, others are per year,
including iOS.
--
Kwpolska <http://kwpolska.tk>
stop html mail | always bottom-post
www.asciiribbon.org | www.
d that for you:
http://paste.pound-python.org/show/25126/
As a bonus, I made it so "yes", "YES", or "YeS " will
yield the same effect.
Hope you are using py3k -- otherwise, replace input with raw_input, as
py2k
he
> list in a column."
>
> ___
> Tutor maillist - Tutor@python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
>
>
> Tutor maillist - Tutor@python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
Please do not top post.
---
And the problem is: add_text_widget() defines a local (function-wide)
`text` object rather than a
= parser.parse_args()
foo = "This line was written by a Python script."
with open(args.filename, 'a') as file:
file.write(foo)
Note that this is the most basic version. Also, I had problems with
running it as a standalone file, but it worked fine in the int
at() syntax instead of %. Like:
> log.debug('Received URI is {}'.format(unicode(sys.argv[1], 'utf-8')))
> log.debug("Receaved URI is type %s"
> % type(unicode(sys.argv[1], 'utf-8')))
What for? It’s unicode or unicode. Or som
before* simpstart. Also, about not “free source”:
(a) did you mean: open source?
(b) why did you publish it here?
--
Kwpolska <http://kwpolska.tk>
stop html mail | always bottom-post
www.asciiribbon.org | www.netmeister.org/news/learn2quote.html
GPG KEY: 5EAAEA16
__
o prefer to
> print to a cleared screen, don't know why, just do.
>
> Mike :)
> ___
> Tutor maillist - Tutor@python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
Or cls & python file.py.
(clear; ./file.py for th
whatever else you used) is set to make sound with the bell.
--
Kwpolska <http://kwpolska.tk>
stop html mail | always bottom-post
www.asciiribbon.org | www.netmeister.org/news/learn2quote.html
GPG KEY: 5EAAEA16
___
Tutor maillist - Tut
I will kill the one who invented this bullshit with the Reply button.
(sent 1 h 13 min ago)
-- Forwarded message --
From: Kwpolska
Date: Mon, Jan 28, 2013 at 4:48 PM
Subject: Re: [Tutor] Facebook login using python
To: Aaron Misquith
On Mon, Jan 28, 2013 at 4:40 PM, Aaron
it shouldn’t filter
swearwords, and even if it does, that it shouldn’t inform me of that.
--
Kwpolska <http://kwpolska.tk> | GPG KEY: 5EAAEA16
stop html mail| always bottom-post
http://asciiribbon.org| http://caliburn.nl/topposting.html
_
.org/mailman/listinfo/tutor
>
Move the print out of the loop. Also, do not post screenshots, use
copy-paste. So, this becomes:
binnum = input("Please enter a binary number: ")
decnum = 0
rank = 1
for i in reversed(binnum):
decnum += rank * int(i)
rank
gt; Probably should flag BitBucket and GitHub as well ?
Not “as well”, “instead”. Because SF is anywhere near human-friendly,
and many awesome coders are on BitBucket (eg. the Pocoo team) and
GitHub (eg. Kenneth Reitz), you can also find some good people on
Launchpad.
--
Kwpolska <http://kwpolska.t
foo_the_bar =
Ugh, you don’t need variables for this. You should do:
if c == '<' or c == '>'
Or, even more Pythonically:
if c in '<>'
Now, for other cases, I suggest OOP and class member values or stuff like that.
gh having a cat sit on your keyboard?
--
Kwpolska <http://kwpolska.tk> | GPG KEY: 5EAAEA16
stop html mail| always bottom-post
http://asciiribbon.org| http://caliburn.nl/topposting.html
___
Tutor maillist - Tutor@python.org
To
use it.
2. Do you need “$”? Why not use the newfangled {} syntax (since
Python 2.6)? Example:
'2 + 2 = {val}'.format(val='fish')
Or:
'2 + 2 = {0}'.format('fish')
Or even:
'2 + 2 = {}'.format('fish')
3. I doubt
Tutor maillist - Tutor@python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
You are probably using Python 3 (check with `python --version`). In
this version, print is a function. You need to do the following
instead:
print(number
Trials)
> --
> Sydney
>
> ___
> Tutor maillist - Tutor@python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
Yup. Similar expressions exist for other binary operators (+, -, *, etc.
ge subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
Two options:
(a) replace `totalCost =` with `return`
-OR-
(b) add `return totalCost` under the equation.
You already used return before, so why didn’t you do it there? Or was
this code auto-added by codecademy?
--
Kwpolsk
_trip_cost(city) + hotel_cost(days) + rental_car_cost(days)
--
Kwpolska <http://kwpolska.tk> | GPG KEY: 5EAAEA16
stop html mail| always bottom-post
http://asciiribbon.org| http://caliburn.nl/topposting.html
___
Tutor maillist -
3 for now to avoid confusion, but at
> some point, since a lot has not been ported to 3.3
http://python3wos.appspot.com/ seems to think otherwise. 60.5% of the
top 200 packages are ported, and two more are getting close
(werkzeug+flask[0]).
[0]:
http://www.reddit.com/r/Python/comments/
in d.items():
do_stuff_with_dict_items_here()
You can use the .keys() and .values() in a similar way. You don’t
need a list 99% of the time. And if you do, it is not hard to make it
one.
--
Kwpolska <http://kwpolska.tk> | GPG KEY: 5EAAEA16
stop html mail
None`/`is not None` comparisons and not much else.
--
Kwpolska <http://kwpolska.tk> | GPG KEY: 5EAAEA16
stop html mail| always bottom-post
http://asciiribbon.org| http://caliburn.nl/topposting.html
___
Tutor maillist - Tutor@python.
/write output”, while f.seek(0) is used to return the
pointer back to the beginning of the file):
f = open('acc', 'w+')
f.write(lot)
f.seek(0)
print f.read()
f.close()
Or using the `with` syntax (a.k.a. the context manager syntax):
with open('acc', 'w+')
;: 0.24; '\xa0so': 0.24;
> [snip 11 more lines]
(replaced tabstops with spaces)
Can you guess what’s wrong in your code?
You are reading only the first line. There are more. How do you
handle that? You need to make your algorithm read all the further
lines that begin with the
true of older Pythons?
Dicts have no order:
>>> {'b': 'c', 'a': 'z'}
{'a': 'z', 'b': 'c'}
Moreover, the sorted() function sorts the keys only (something that
list() does anyway). If you are looking for a wa
subprocess
self.textEdit.setText(subprocess.check_output(('command',
'argument1', 'argument2')))
And you do that in the function that is called when you press OK.
Bonus suggestion: do nice layouts instead of setting the coordinates
manually. The option
ttp://docs.python.org/3/library/functions.html?highlight=zip#zip
Downloads for those docs, if you believe this would be more convenient
for you, are available at http://docs.python.org/2/download.html and
http://docs.python.org/3/download.html (for Python 2 and 3
respectively)
--
Kwpolska <ht
On Wed, Jun 19, 2013 at 8:11 PM, Jim Mooney wrote:
> As for downloadable help, I have a chm file, and the Search is terrible.
Get the sane html format, where the search is more useful.
--
Kwpolska <http://kwpolska.tk> | GPG KEY: 5EAAEA16
stop html mail| always bottom-
On Fri, Jun 21, 2013 at 4:59 AM, SM wrote:
>> # Replace stdout if needed
>> sys.stdout = self.oldstdout
It’s better to do it no matter what. Otherwise, hell might break loose.
--
Kwpolska <http://kwpolska.tk> | GPG KEY: 5EAAEA16
stop html mail| alway
ste it into the To: field of your reply.
And replying to the human instead of the list is almost never what you want.
--
Chris “Kwpolska” Warrick <http://kwpolska.tk>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
_
right?
Not quite. db.Model is basically a representation of a database
record. Read this:
http://docs.sqlalchemy.org/en/rel_0_8/orm/tutorial.html
Note that the above document uses the name `Base` (declarative base)
to describe what Flask-SQLAlchemy calls `db.Model`.
--
Chris “Kwpolska” Warrick &
ging the message upon having that
> occur at least 10 times is
> #what's giving me trouble.
You need to count it somewhere, and test it. With that, it becomes
fairly obvious, but with a catch: a one-off error can be easily made.
Have some code:
print
without
any commas whatsoever.
--
Chris “Kwpolska” Warrick <http://kwpolska.tk>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http
ign `i` to X.next() (or X.__next__() in Python 3; equivalent to next(X))
3. if a `break` statement occurs anywhere, get out of the `for` block;
elif StopIteration is raised, the `else` block is executed (if any)
and then the program continues;
else, go to
, with the correct code.
Also, do you mind phrasing your question more precisely? Do you need
help with inheritance? What is the problem you’re having?
--
Chris “Kwpolska” Warrick <http://kwpolska.tk>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
__
mode?
>
>
> thanks
>
> Gabriele
>
> ___
> Tutor maillist - Tutor@python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
>
--
Chris “Kwpolska” Warrick <http://kwpolska.tk&g
referring to it. Do this:
for x in myTeams:
x.print_team()
This causes this output:
[kwpolska@kw-cassandra /tmp]% python foo.py
code is: a
code is: aa
code is: b
code is: bb
code is: c
code is: cc
code is: d
team code is: a
debated: team code is: aa
debated: team code is: b
debated:
code on the desktop, because the desktop is a pain to find from a command
line.
Painful? How painful can `cd Desktop` be? Certainly less than `D:` followed
by `cd PythonProjects`…
--
Chris “Kwpolska” Warrick
___
Tutor maillist - Tutor@python.org
To
On Fri, Mar 28, 2014 at 2:17 AM, Alan Gauld wrote:
> On 27/03/14 21:01, Chris “Kwpolska” Warrick wrote:
>> Painful? How painful can `cd Desktop` be? Certainly less than `D:`
>> followed by `cd PythonProjects`…
>
>
> Because the desktop is hardly ever anywhere near where th
# normal key press, append it to end of display
> self.display.setText(text+key)
>
> def run(self):
> # infinite event loop to process button clicks
> while True:
> key = self.getButton()
> self.processButton(key)
>
> #this runs the
, [2.0, 5, [10, 20]]]
x contains:
0. the string 'a'
1. the list:
0. the float 2.0
1. the integer 5
2. the list:
0. the integer 10
1. the integer 20
--
Chris “Kwpolska” Warrick <http://kwpolska.tk>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 m
the official Python tutorial if you are an experienced
developer.)
Also, Bootstrap is a front-end framework: http://getbootstrap.com/ —
and you’re better off asking HTML/CSS people for advice, after you
read the extensive docs.
--
Chris “Kwpolska” Warrick <http://kwpolska.tk>
PGP: 5EAAEA16
print('s={0} {1}'.format(s, n))
This will produce "s=8 5". If you want "s=85", remove the space in
the format string.
--
Chris “Kwpolska” Warrick <http://kwpolska.tk>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
__
.cgi
Sadly, this is not the modern way to do it. These days, it’s
recommended to use something like Flask, or Django, or whatnot. CGI
is ancient, and problematic.
--
Chris “Kwpolska” Warrick <http://kwpolska.tk>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
orrect way is compiling it on your own (the usual
Unix way, but using `make altinstall` for the install step).
virtualenv won’t help in this case, it’s not what virtualenv is for.
--
Chris “Kwpolska” Warrick <http://kwpolska.tk>
PGP: 5EAAEA16
stop html mail | always b
th Nikola’s development; however,
even with that aside, I believe Nikola is much more human-friendly
than Pelican. To each their own, though.
--
Chris “Kwpolska” Warrick <http://chriswarrick.com/>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
__
For local testing, use
python -m SimpleHTTPServer
or, if you’re on Python 3,
python3 -m http.server
--
Chris “Kwpolska” Warrick <http://chriswarrick.com/>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
___
Tutor
eSpeech.net/>).
On Fri, Jul 11, 2014 at 6:21 AM, Danny Yoo wrote:
> The ones I use for my personal and professional use are webfaction.com and
> appengine.google.com. I'm sure others can give more suggestions.
Both are services used for hosting webapps, not static websites.
--
utput that's very close to Excel’s, why not just use
Excel’s save as webpage capabilities? You can automate that, with Python or
something else (like Excel macros or Windows-specific automation software).
It's much easier to do it this way, and it guarantees good output without
much effort.
e -e option to fail when a command exits with a non-zero status.
You should always have a shebang line in your shell files, and execute
them as ./shellTest.sh (after chmod +x shellTest.sh); moreover, one
for Python files is recommended, like this: #!/usr/bin/env python
--
Chris
need is:
python test.py && python second.py
However, you need to explicitly stack all the commands you want to
execute this way — so, if there are more things, `set -e` might also
be of use. (you would need an even uglier tree for `if`s.)
--
Chris “Kwpolska” Warrick <http://chriswarrick
On Thu, Jul 24, 2014 at 2:14 PM, Wolfgang Maier
wrote:
> On 24.07.2014 14:09, Chris “Kwpolska” Warrick wrote:
>>
>> On Thu, Jul 24, 2014 at 2:01 PM, Wolfgang Maier
>> wrote:
>>>
>>> Try something like this (assuming bash):
>>>
>>> python
On Thu, Jul 24, 2014 at 2:23 PM, Wolfgang Maier
wrote:
> On 24.07.2014 14:19, Chris “Kwpolska” Warrick wrote:
>>
>>
>>>>> python test.py
>>>>> if [ $? = 0 ]; then
>>>>> python second.py
>>>>> fi
>>&g
It looks ilke this WONDERFUL mailing list which does not do something
as basic as a sane Reply-to header made me send a response to the OP
only. Here it is again:
-- Forwarded message --
From: Chris “Kwpolska” Warrick
Date: Fri, Aug 8, 2014 at 7:36 PM
Subject: Re: [Tutor
ang.python). Long story short, modern Android phones are using the
MTP protocol and do not behave like usual USB drives. You must use a module
that implements MTP if you want to access your phone.
> import os;
No need for a semicolon here.
--
Chris “Kwpolska” Warrick <http://chriswarrick.co
ilman/listinfo/tutor
>
Don't use regular expressions for HTML. Use lxml instead.
Also, why would you need that exact thing? It's useless. Also, this code is
very ugly, with too many s and — worse — s which should not be
used at all.
--
Chris “Kwpolska” Warrick <http://chriswarrick.com/
about the protocol. You can Google the term “python MTP”, you may
find some answers there.
--
Chris “Kwpolska” Warrick <http://chriswarrick.com/>
Sent from my SGS3.
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription
On 18 August 2014 02:45 "ALAN GAULD" wrote:
> > At the Community College we used Python version 3.4.0 which I guess is
up to date.
>
> Yes indeed, the latest and greatest.
The “latest and greatest” is actually 3.4.1.
--
Chris “Kwpolska” Warrick <http://chriswarric
opment).
I personally recommend you just get a virtual machine running some
Linux instead of playing with Windows.
--
Chris “Kwpolska” Warrick <http://chriswarrick.com/>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
___
n both OSes (and even in some Windows VMs).
--
Chris “Kwpolska” Warrick <http://chriswarrick.com/>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription op
r of times through the loop, defaulting
| to one million. The main statement, the setup statement and
| the timer function to be used are passed to the constructor.
--
Chris “Kwpolska” Warrick <http://chriswarrick.com/>
PGP: 5EAAE
t; Just as an aside — Apple has stopped charging for OS-X.
Sebastan probably meant “free” as in Stallman:
http://www.gnu.org/philosophy/free-sw.html
(most people believe free = $0. FSF people, however, want to steal
that word for their concept. Not very successful at that, as you can
se
ile_contents = infile.read()
>
> infile.close()
>
> print(file.contents)
>
>
>
> main()
>
>
> ___
> Tutor maillist - Tutor@python.org
> To unsubscribe or change subscription options:
> https://mail.python.or
here; the main drive is just /.
Also, the path separator is a forward slash (/). This also lets you
remove the r in front of the string, which is needed for backslashes
unless you escape them. The corrected code is:
infile = open('/Users/richarddillon/Desktop/my_file', 'r
;)
It’s better to let Python show the exceptions.
--
Chris “Kwpolska” Warrick <http://chriswarrick.com/>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
___
Tutor maillist - Tutor@python.org
To unsubscribe or change s
combination to an app? What is it, exactly,
that you want to do? What app uses Shift+Enter in the way you want to
use it?
--
Chris “Kwpolska” Warrick <http://chriswarrick.com/>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
x27;html')
> msgAlternative.attach(msgText)
>
> for image in l:
> with open(image, 'rb') as fh:
> msgImage = MIMEImage(fh.read())
> msgImage.add_header('Content-ID', '<{0}>'.format(image))
> msgRoot.attach(msgI
Text = MIMEText('…rest of your
HTML here, complete with {time} and {date}
tags…'.format(time=t, date=d), 'html')
msgAlternative.attach(msgText)
--
Chris “Kwpolska” Warrick <http://chriswarrick.com/>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes
76 matches
Mail list logo