473,491 Members | 2,248 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Arrays and Structures (or User Types) [solved]

2 New Member
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.
Oct 24 '06 #1
3 1295
bvdet
2,851 Recognized Expert Moderator Specialist
Maybe a dictionary would work for you.
Some examples:
Expand|Select|Wrap|Line Numbers
  1. dd12 = {"z1":"L6x4x3/8", "f2":"Zinc Oxide", "a3":(120.0, 220.0, 320.0)}
  2. dd13 = {"ddd":55.2478, "eee":"Works", "fff":36}
  3.  
  4. print dd13["eee"]
  5. dd13["eee"] = 'Busted'
  6.  
  7. for k, v in dd13.items():
  8.         print k, "=", v
  9.  
  10. dd12 = {"z1":"L6x4x3/8", "f2":"Zinc Oxide", "a3":120.0000}
  11.  
  12. dd12.update(dd13)
  13. print dd12
  14.  
  15. for k, v in dd12.items():
  16.         print k, "=", v
  17.  
  18.  
Oct 24 '06 #2
Felagund
2 New Member
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 ?
Oct 24 '06 #3
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
Oct 24 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
2519
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...
5
1494
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;
12
1679
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;
4
2182
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...
1
4970
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...
0
1343
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. ...
5
2867
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
5
2539
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,...
2
1484
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. ...
0
7115
marktang
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,...
0
6978
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...
0
7190
jinu1996
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...
0
7360
tracyyun
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...
0
5451
agi2029
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,...
1
4881
isladogs
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...
0
4578
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...
0
1392
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 ...
1
633
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.