On Sep 20, 2:20*pm, Andrew <aet...@gmail.comwrote:
please explain this behavior to a newb:
>a = [1,2,3,4] b = ["a","b","c","d"] a
[1, 2, 3, 4]
>b
['a', 'b', 'c', 'd']
>a[0:2]
[1, 2]
>a
[1, 2, 3, 4]
>b[2:4]
['c', 'd']
>a[0:2] = b[0:2] b[2:4] = a[2:4] a
['a', 'b', 3, 4]
>b
['a', 'b', 3, 4]
What else would you expect to happen? 0 745 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Rich Krauter |
last post by:
I do not understand why python behaves the way it does
in the following code:
Here, Python doesn't like that I'm assigning
out-of-range. OK. That's fine.
>>> x =
>>> x = 3
Traceback (most...
|
by: Jens Lippmann |
last post by:
Hi all!
I'm new to Python and just tried to assign values to a portion
of a string, but I don't get it.
My code is:
bits = '\3ff' * bmi.bmiHeader.biSizeImage
ofs = 0x1E2C0
for i in range(0,...
|
by: Ron Adam |
last post by:
After considering several alternatives and trying out a few ideas with a
modified list object Bengt Richter posted, (Thank You), I think I've
found a way to make slice operation (especially far end...
|
by: truckaxle |
last post by:
I am trying to pass a slice from a larger 2-dimensional array to a
function that will work on a smaller region of the array space. The
code below is a distillation of what I am trying to...
|
by: Antoon Pardon |
last post by:
Now slices are objects in python, I was wondering if slice
notation will be usable outside subscribtion in the future.
Will it ever be possible to write things like:
a = 4:9
for key, value in...
|
by: Alexandre Guimond |
last post by:
Hi all,
i'm trying to deepcopy a slice object but i get the following error.
Does anyone know a workaround?
ActivePython 2.4.3 Build 12 (ActiveState Software Inc.) based on
Python 2.4.3 (#69,...
|
by: smichr |
last post by:
It seems to me that the indices() method for slices is could be
improved. Right now it gives back concrete indices for a range of
length n. That is, it does not return any None values. Using an...
|
by: John Salerno |
last post by:
Hey all. I've decided I let my Python skills (minor though they were)
slip away so I started reading the new edition of Learning Python to
brush up. I just read about lists again and I'm wondering...
|
by: Andrew |
last post by:
please explain this behavior to a newb:
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |