Ciao,
I'm trying to convert to Python an existing program written in VB and I cannot find out an equivalent way to translate a Private Type description which includes another type and the relevant matrix. I was thinking that some Lists and Classes can do the job, but the result is really different and I can't find a way to insert unknown quantity of data inside a structure like an array of matrices. Could you please give me some hints ? Thanks a lot in advance.
3 1295 bvdet 2,851
Recognized Expert Moderator Specialist
Maybe a dictionary would work for you.
Some examples: -
dd12 = {"z1":"L6x4x3/8", "f2":"Zinc Oxide", "a3":(120.0, 220.0, 320.0)}
-
dd13 = {"ddd":55.2478, "eee":"Works", "fff":36}
-
-
print dd13["eee"]
-
dd13["eee"] = 'Busted'
-
-
for k, v in dd13.items():
-
print k, "=", v
-
-
dd12 = {"z1":"L6x4x3/8", "f2":"Zinc Oxide", "a3":120.0000}
-
-
dd12.update(dd13)
-
print dd12
-
-
for k, v in dd12.items():
-
print k, "=", v
-
-
Ciao,
Thanks a lot for your help, do you know if there is the possibility to create an array for these Dictionaries ? What I need is, let say 100 (or any number) placeholders for a dictionary where to put all the extracted data from the input file. In VB you can do that dimensioning an array like graphics(100) and you can create this graphics as a user defined type (in C they called Structures) which contains the various info for that graphics (Xloc, Yloc, Type, etc.) are the dictonaries usable for the same kind of thing in your opinion ?
bartonc 6,596
Recognized Expert Expert
Ciao,
Thanks a lot for your help, do you know if there is the possibility to create an array for these Dictionaries ? What I need is, let say 100 (or any number) placeholders for a dictionary where to put all the extracted data from the input file. In VB you can do that dimensioning an array like graphics(100) and you can create this graphics as a user defined type (in C they called Structures) which contains the various info for that graphics (Xloc, Yloc, Type, etc.) are the dictonaries usable for the same kind of thing in your opinion ?
numpy extenstion handles arrays very nicely. Get it at http://numpy.scipy.org/.
It allows you to create array objects of a given size and type of object they will hold and the use them much like lists only better because you can also do matrix math on them.
PS: Welcome to the python forum on thescript.com! Please be sure to use code tags (read the gray writing on the background of the post screen or the panel on the right of the post screen or the sticky at the top of the forum). Thank you,
Barton
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: refer_to_website |
last post by:
My VB.NET web application has a textbox where the user is allowed to
enter up to 50 characters. I have a label on the form next to the
textbox that tells the user how many remaining characters he...
|
by: mungflesh |
last post by:
I am new to PHP. Can I define an array in PHP 4.3 containing class
types?
ie. (simplified example)
class MyType
{
function MyFunc()
{
$newType = new MyType;
|
by: Franz |
last post by:
Greetings,
I have created the following types:
typedef struct _tbl_certificate{
int cert_id;
char *cert_name;
}tbl_certificate;
typedef struct _cameraObj{
tbl_camera camera;
|
by: Jason Cowsill |
last post by:
Hi -
I am looking for a way to dynamically alter a textbox WHILE the user is
typing in it. One example would be while a user is entering their phone
number a dash would be entered automatically...
|
by: GAURAV KRISHNA |
last post by:
I am able to deserialize an array using XMLSerializer but the size of an
array is 0.The problem seems to be because of unqualified element name but I
am not very sure.
Here is what I did:
I...
| |
by: Art Cummings |
last post by:
Good morning all. I just finished an assignment using structures. In this
assignment I used an array of structures. What I would have liked was to
use an array of structures with a function. ...
|
by: kenrocks |
last post by:
my problem is to ensure that what the user types for the index of an array is really a digit and not a letter...please answer a.s.a.p. thx:D
|
by: premMS143 |
last post by:
I'm having idea in VB 6.0 & HTML. Based on this trying to build a simple web application using ASP.NET 3.5, VB as code behind & SQL 2000 for database.
Here, I got one doubt.
In the Login Form,...
|
by: premMS143 |
last post by:
Hi everyone,
I'm using ASP.NET & VB for programming.
The problem is restricting the users based on the user types.
I've several user types, like Admin, Student, Parent, Coordinator etc.
...
|
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: 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...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |