unction name, since the latter is typically used for classes, and
perhaps call it read_file to better describe it?
--
Chris Warrick <https://chriswarrick.com/>
PGP: 5EAAEA16
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subs
planation
> for this.
This indicates the return type: input() returns a string.
--
Chris Warrick <https://chriswarrick.com/>
PGP: 5EAAEA16
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
es. Instead of tail, you should use Python’s standard file
operations (open()) to accomplish your task.
[advertisement] Extra reading on security (shell=False) and the
necessity of calling subprocesses:
https://chriswarrick.com/blog/2017/09/02/spawning-subprocesses-smartly-and-securely/
[/advert
exist.)
¹ Progressive enhancement: adding more features that need extra
columns I didn’t think of first. Or removing features that weren’t
cool. Or restoring them the next day.
--
Chris Warrick <https://chriswarrick.com/>
PGP: 5EAAEA16
___
Tutor
())
search_key = str(input("> "))
if search_key in data:
print(search_key, ":", data[search_key])
else:
print("Not in dictionary.")
(I also cleaned it up a little)
--
Chris Warrick <https://chriswarrick.com/>
PGP: 5EAAEA16
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
t; an hour, maybe forty five minutes later and my little project did what I was
> trying to do. This was before I really knew any python; the language was
> that clean and easy to learn.
You can still do that with Python 3. (Although you’ll be better off
using asyncio and some IRC li
utorial/index.html
[1] http://greenteapress.com/wp/think-python-2e/
[2] https://automatetheboringstuff.com/
[3] https://learnpythonthehardway.org/book/nopython3.html
[4] https://eev.ee/blog/2016/11/23/a-rebuttal-for-python-3/
--
Chris Warrick <https://ch
ip some unrelated stuff]
dependency: python3-pip
provider: python3-pip-9.0.1-9.fc26.noarch
dependency: python3-setuptools
provider: python3-setuptools-36.2.0-1.fc26.noarch
On other distributions, it usually isn’t, although many users will
eventually end up with a copy.
--
Chris Warri
On 9 August 2017 at 23:15, Steven D'Aprano <st...@pearwood.info> wrote:
> On Tue, Aug 08, 2017 at 12:56:56PM +0200, Chris Warrick wrote:
>
>> While setuptools is not officially part of the stdlib,
>
> This is the critical factor. How can you use *by default* something
e top 360 packages on
PyPI use wheels. It means that at least that many use setuptools;
sometimes with a distutils fallback, but often without one. Moreover,
many of the packages without wheels use setuptools as well.
The sane default choice is entry_points.
; basis for application plugin systems
> * the ability to automatically generate Windows command line executables at
> installation time rather than needing to prebuild them
And, as eryk sun mentioned, recent Python 2.7 and 3.4 versions ship
setuptools and pip, via the ensurepip module.
--
Ch
running your
script by opening the created .exe files does not show a console
window. Note that stdout/stderr do not work in that mode under
Windows, which can lead to spurious application crashes. (GUI-only
processes cannot use stdout/stderr because they don’t have a console
attached)
I’ll take the liberty to link my (better) blog post about this:
https://chriswarrick.com/blog/2014/09/15/python-apps-the-right-way-entry_points-and-scripts/
--
Chris Warrick <https://chriswarrick.com/>
PGP: 5EAAEA16
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
’re making things more akin to shell scripts, using just
entry_points makes stuff harder, because you need to install the code
(and write a setup.py), as opposed to just putting the script
somewhere in $PATH.
--
Chris Warrick <https://chriswarrick.com/>
PGP: 5EAAEA16
ature,
and a necessity for debugging (tracebacks!)
On the other hand, some of the better editors (eg. Visual Studio Code)
provide .zip packages that do not require installation and can even
run off a USB stick.
--
Chris Warrick <https://chriswarrick.com/>
PGP: 5EAAEA16
_
On 16 April 2017 at 18:16, Jim <jf_byr...@comcast.net> wrote:
> On 04/16/2017 10:10 AM, Chris Warrick wrote:
>>
>> On 16 April 2017 at 16:45, Jim <jf_byr...@comcast.net> wrote:
>>>
>>> My system python is 2.7.12 so I created a virtual environment using
r 3.5.2 without
> breaking things?
No. You need to delete your existing virtualenv and create a new one.
You can just use `pip freeze > requirements.txt` in the old one and
run `pip install -r requirements.txt` in the new one to ”move” all the
packages you had.
--
Chris Warrick <https:
(cmd.exe).
DOS is not part of Windows NT/2000/XP and better, and rightfully so.
[0]: In Windows 8?/10, available from the File menu. Otherwise:
http://www.askvg.com/enable-open-command-window-here-option-in-context-menu-in-windows-vista/
--
Chris Warrick <https://chriswarrick.com/>
PGP:
ion options:
> https://mail.python.org/mailman/listinfo/tutor
Please paste the full error message, and your complete source code.
Also, make sure you are running the commands in the regular command
prompt window, and not in a Python-specific one.
Also, your scripts should not live in C:\Pyt
ensive tutorial on
deploying a Python application on a Linux server:
https://chriswarrick.com/blog/2016/02/10/deploying-python-web-apps-with-nginx-and-uwsgi-emperor/
--
Chris Warrick <https://chriswarrick.com/>
PGP: 5EAAEA16
___
Tutor maillist
thing[loc[0]] means “check what the 0th element of `loc` (`loc[0]`)
is, and use it as an index for `thing` (`thing[…]`).
--
Chris Warrick <https://chriswarrick.com/>
PGP: 5EAAEA16
___
Tutor maillist - Tutor@python.org
To unsubscribe or c
On 13 January 2016 at 21:49, Mark Lawrence <breamore...@yahoo.co.uk> wrote:
> On 09/01/2016 10:38, Chris Warrick wrote:
>>
>> On 8 January 2016 at 20:07, bruce <badoug...@gmail.com> wrote:
>>>
>>> So, where does IDLE fit into this
>>
>
han the basic interpreter, and
even have more features than IDLE.
--
Chris Warrick <https://chriswarrick.com/>
PGP: 5EAAEA16
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
ng print() with commas adds spaces between all entries, which
might look bad (and it does in this example); the only way to prevent
that is by setting `sep=`, but then you need to remember about a space
after "visited" and around the ampersand…
* Easy to localize (translate into different languag
the normal
`python3` shell, ipython or bpython.
The correct fix is to exit() from the python3 shell and start it again.
Alternatively, add some main code at the end of your file and use
`python3 hlibert.py`:
if __name__ == '__main__':
hilbert(3)
gument parsing solution, and implement it
with two arguments.
--
Chris Warrick <https://chriswarrick.com/>
PGP: 5EAAEA16
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
it, just create a dict and use it — you can
have arbitrary variable names just fine:
things = {}
a = "aabb"
things[a] = []
PS. why are you creating a out of two strings? Why not just a = "aabb"?
--
Chris Warrick <https://chriswarrick.com/>
PGP: 5EAAEA16
/mailman/listinfo/tutor
Don’t create custom bin/ scripts, use setuptools entry points. I
described it on my blog:
https://chriswarrick.com/blog/2014/09/15/python-apps-the-right-way-entry_points-and-scripts/
--
Chris Warrick https://chriswarrick.com/
PGP: 5EAAEA16
in this case,
regular strings will do it equally well and are more readable.
--
Chris Warrick https://chriswarrick.com/
PGP: 5EAAEA16
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo
system locale is set
correctly. If it isn’t,
p = b你好.decode('utf-8')
would do it.
--
Chris Warrick https://chriswarrick.com/
PGP: 5EAAEA16
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org
subscription options:
https://mail.python.org/mailman/listinfo/tutor
In Python 3, raw_input() was renamed to input().
a = input(Write down your name: )
Note that input() is also a thing in Python 2, but you shouldn’t use
that one for security reasons. Python 3’s is fine though.
--
Chris Warrick
Do it yourself at https://mail.python.org/mailman/listinfo/tutor .
Besides, your email is @gmail.com, not @google.com.
--
Chris Warrick http://chriswarrick.com/
PGP: 5EAAEA16
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription
31 matches
Mail list logo