I need to assign lists containing class objects to a key (so i can create var names for a user defined numb of objts). I tried appending to the key of a list and couldnt get it to work. How would i manipulate objects when i rely on a dictionary to refer to them? :/
You can easily modify dictionary values by reassignment or manipulation of the value or its attributes. - >>> dd = {"a": 123, "b": 456}
-
>>> dd["a"] += 321
-
>>> dd
-
{'a': 444, 'b': 456}
-
>>> dd = {"a": [1,2,3], "b": [4,5,6]}
-
>>> dd["a"].append(4)
-
>>> dd
-
{'a': [1, 2, 3, 4], 'b': [4, 5, 6]}
-
>>>
3 1889 bvdet 2,851
Expert Mod 2GB
You can easily modify dictionary values by reassignment or manipulation of the value or its attributes. - >>> dd = {"a": 123, "b": 456}
-
>>> dd["a"] += 321
-
>>> dd
-
{'a': 444, 'b': 456}
-
>>> dd = {"a": [1,2,3], "b": [4,5,6]}
-
>>> dd["a"].append(4)
-
>>> dd
-
{'a': [1, 2, 3, 4], 'b': [4, 5, 6]}
-
>>>
Hold one....maybe I wrote the code up wrong.... :P
Yeh...I wrote it up wrong somehow yesterday....
ty
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Jonathan Buckland |
last post by:
Can someone give me an example how to append data without having to
load the complete XML file.
Is this possible?
Jonathan
|
by: Winterminute |
last post by:
I am binding the results of a database query to a DataList using the
following code:
SqlDataAdapter myCommand = new SqlDataAdapter("SELECT * FROM
_Hardware_Configurations", myConnection);...
|
by: Steve Lloyd |
last post by:
Hi there,
I have a set of products each of which has attributes (color size etc), is
it possible to use a data list or repeator to display all the items and
provide combo box with a unique set...
|
by: Shahid Saleem |
last post by:
Dear Members
I want to generate a Template using DataList and i want to user Grid
control in the item template, is it possible. if yes need some
explanation regarding data binding of grid...
|
by: Shahid Saleem |
last post by:
Dear Members
I am using a data list , in the item template i have used a data grid
with template column (CheckBox) and a button named sumbit.
I want to get the data grid selected rows(Makred...
|
by: HYRY |
last post by:
I have the following questions, I am using Python 2.4.2
19167152 #1
11306608 #1
1. the address of a.append and list.append is different, can I get the
address of...
|
by: Milan Mehta |
last post by:
I am a newbie to MS Access. Please bear with me for such question.
I have a table1 in Database1. I need to append data from table2 in Database2 to table1 of Databases1. How can I do that ?
TIA...
|
by: Pat |
last post by:
I know it's not "fair" to compare language features, but it seems to me
(a Python newbie) that appending a new key/value to a dict in Python is
awfully cumbersome.
In Python, this is the best...
|
by: premMS143 |
last post by:
How to append Data to an existing Excel file?
means,
I'm using VB as front end & once I exported the data to Excel file & saved it as 'ABC.xls'.
Now, the question/doubt is;
I addded some more...
|
by: Busbait |
last post by:
Hi,
I have the following code which works fine in MS Access 2007. It export current access form records to an excel sheet:
DoCmd.OutputTo acOutputQuery, "RunQuery", acFormatXLSX, , True
Is...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
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: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
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...
| |