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
s 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
end on tail being
available (it’s not on Windows), and there may also be version
differences. 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:/
ressive 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 maillist - Tutor@
.keys())
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
started playing. Half
> 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
teapress.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://chriswarrick.com/>
PGP: 5EAAEA16
_
[snip 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 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 that
> is *NOT* supplied
ns 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.
--
Chris Warrick <https://chriswarrick.com/>
PGP: 5EAAEA16
__
ystems
> * 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.
--
Chris Warrick <https://chris
cript" vs "console_scripts entry-point"?
Simple: `scripts` are legacy. `entry_points` are the new thing.
There’s also a third approach: gui_scripts entry_points, which work
the same way on Linux/*nix, but on Windows, it means that running your
script by opening the created .exe fi
e 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
__
ging (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 wrote:
> On 04/16/2017 10:10 AM, Chris Warrick wrote:
>>
>> On 16 April 2017 at 16:45, Jim wrote:
>>>
>>> My system python is 2.7.12 so I created a virtual environment using venu
>>> to
>>> run 3.5.2. I put it in
gs?
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://chriswarrick.c
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: 5EAAEA16
___
ail.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:\Python27, because they might
conflict wit
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 - Tutor@python.org
To unsubs
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 change subscription options:
http
On 13 January 2016 at 21:49, Mark Lawrence wrote:
> On 09/01/2016 10:38, Chris Warrick wrote:
>>
>> On 8 January 2016 at 20:07, bruce wrote:
>>>
>>> So, where does IDLE fit into this
>>
>>
>> IDLE is a sad little “IDE”, which is really ugl
nterpreter, 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
nt() 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
thon 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)
--
Chris Warrick <https://chriswarrick.com/>
PGP: 5EAAEA16
_
t; seen an example of this on the web).
1. NEVER use eval().
2. Trying to pass Python code as arguments looks bad. Don’t do that.
3. Your issues with '' are caused by your shell. You would need to
wrap your entire thing in quotes first, or use escaping. But instead,
4. Use argpa
ct 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
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
_
> Tutor maillist - Tutor@python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
Don’t create custom bin/ scripts, use setuptools entry points. I
described it on my blog:
https://chriswarrick.com/blog/2014/0
his line — in that case, you can even drop the
if/else and just use the same dictionary assignment for both Pythons.
Just be warned that it applies to the entire file and can lead to
problems.
PS. There is no reason to use """multi-line strings""" in this case,
regular "
gt;>> p = "你好".decode('utf-8')
>>> p
u'\u4f60\u597d'
However, this does not apply in Python 3. Python 3 defaults to
Unicode strings, so you can do:
>>> p = "你好"
and have proper Unicode handling, assuming your system locale is set
_
> Tutor maillist - Tutor@python.org
> To unsubscribe or change 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 Pyt
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
31 matches
Mail list logo