On Tuesday, July 27, 2021 at 5:05:27 AM UTC-7, Terry Reedy wrote:
> On 7/26/2021 6:19 PM, Glenn Wilson via Python-list wrote:
> > I recently downloaded the latest version of python, 3.9.6. Everything works
> > except, the turtle module. I get an error message every time , I use basic
> > command
On 7/26/2021 6:19 PM, Glenn Wilson via Python-list wrote:
I recently downloaded the latest version of python, 3.9.6. Everything works
except, the turtle module. I get an error message every time , I use basic
commands like forward, backward, right and left. My syntax is correct:
pat.forward(10
the way they probably did not write proper code in the first
place that loads the module(s) they need?
-Original Message-
From: Python-list On
Behalf Of Dennis Lee Bieber
Sent: Monday, July 26, 2021 9:46 PM
To: python-list@python.org
Subject: Re: a simple question
On Mon, 26 Jul 2021 22:19
On 27/07/2021 10.19, Glenn Wilson via Python-list wrote:
> I recently downloaded the latest version of python, 3.9.6. Everything works
> except, the turtle module. I get an error message every time , I use basic
> commands like forward, backward, right and left. My syntax is correct:
> pat.forwa
It would help to know the error message you get every time.
On Mon, 2021-07-26 at 22:19 +, Glenn Wilson via Python-list wrote:
> I recently downloaded the latest version of python, 3.9.6. Everything
> works except, the turtle module. I get an error message every time ,
> I use basic commands l
Ahh, that make sense! Thanks a ton!
--
http://mail.python.org/mailman/listinfo/python-list
Tuvas wrote:
> Why is the output list [[0, 1], [0, 1]] and not [[0,
> 1], [0, 0]]? And how can I make it work right?
http://www.python.org/doc/faq/programming.html#how-do-i-create-a-multidimensional-list
--Ben
--
http://mail.python.org/mailman/listinfo/python-list
Skip answered why, but not how to make it work right:
>>> x = [[0]*2 for x in range(2)]
>>> x
[[0, 0], [0, 0]]
>>> x[0][1]=1
>>> x
[[0, 1], [0, 0]]
Cheers,
n
--
http://mail.python.org/mailman/listinfo/python-list
>>> x=[[0]*2]*2
This replicates the references. It doesn't copy objects.
This short transcript demonstrates that concept:
>>> x = [[0, 0], [0, 0]]
>>> map(id, x)
[16988720, 16988160]
>>> y = [[0]*2]*2
>>> y
[[0, 0], [0, 0]]
>>> map(id, y)
[16988520, 16988520
Haibao Tang wrote:
> I have a two-column data file like this
> 1.12.3
> 2.211.1
> 4.31.1
> ...
> Is it possible to substitue all '1.1' to some value else without using
> re.
I suppose that you don't want '11.1' to be affected.
raw_data="""
1.12.3
2.211.1
4.31.1
"""
data =
Haibao Tang wrote:
> Is it possible to substitue all '1.1' to some value else without using
> re.
You could try:
import sys
values = sys.stdin.readline().split()
while values:
results = []
for value in values:
if value != '1.1':
results.append(value)
else:
"Haibao Tang" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>I have a two-column data file like this
> 1.12.3
> 2.211.1
> 4.31.1
> ...
> Is it possible to substitue all '1.1' to some value else without using
> re.
>
Yes --
data = """1.12.3
2.211.1
4.31.1"""
someone wrote:
> I cannot quite understand when the third index is a negative
> number,like this:
> a = '0123456789'
> a[1:10:2] I know the index step is 2, so it will collect items from
> offset 1, 3, 5, 7, 9
> but when a negative number come,like:
> a[1::-1] answer '10', and a[1:10:-1] only answ
13 matches
Mail list logo