Python Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPython Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #16  
Old August 19th, 2003, 08:16 PM
oni9 oni9 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Location: Brisbane, Australia
Posts: 50 oni9 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 10
Quote:
Originally posted by netytan
I dont know what this string array is . In C/C++ strings are char arrays but a Python string and list/array are two totally different types..

readlines() returns a list/array and read() returns a string.

likewise..

writelines() writes takes an array and writes it to a file, and write() takes a string.

If somone could explain the whole string array idea i would really appreciate it.

Thanks,
Mark.


um......
considering strings are char array (or array/list of char?) in C/C++

you will get string arrays as array/list of string
or array/list of (array/list of char),
in simpler term = 2 Dimention array of char

string array was how my Software Development lecturer used to describe "array of (array of char)"

by the way, how do I define a multi-dimention array?

in VB
dim my2DAry as Integer(,) = {{1,2},{3,4}}
in C++
int my2DAry[2][2] = {{1,2},{3,4}};
in C#
int[,] myArray = new int[,] {{1,2},{3,4}};

what about Python?

Reply With Quote
  #17  
Old August 19th, 2003, 09:18 PM
netytan's Avatar
netytan netytan is offline
Hello World :)
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Mar 2003
Location: Hull, UK
Posts: 2,537 netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 2 Days 18 h 17 m 47 sec
Reputation Power: 68
Send a message via ICQ to netytan Send a message via AIM to netytan Send a message via MSN to netytan Send a message via Yahoo to netytan
Ah ok, so if i understand you a string array is a list of strings like..

>>> array = ['this', 'is', 'a', 'string', 'array']
>>> array
['this', 'is', 'a', 'string', 'array']
>>>

have I got it?

multi-dimention lists/arrays in Python are really easy..

myarray = [[1, 2, 3, 4, 5, 6, 7, 8, 9], [10, 11, 12, 13, 14, 15, 16, 17, 18, 19]]

and accessing these lists/arrays is even simpler..

myarray[0][0] = 1 and myarray[1][2] = 11

Theres more about this at http://forums.devshed.com/t77039/s.html

Mark.

Reply With Quote
  #18  
Old August 20th, 2003, 12:24 AM
oni9 oni9 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Location: Brisbane, Australia
Posts: 50 oni9 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 10
thanks netytan for the muti-D list/array

and yes, string array(list) an array(list) of string
['row1', 'row2', 'row3']

Reply With Quote
  #19  
Old August 20th, 2003, 01:15 AM
percivall percivall is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 133 percivall User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 10
Re: array of array, etc.

Similar to how a numbers are defined: A number is defined to be a plurality of a plurality of a plurality, according to Frege.


Reply With Quote
  #20  
Old August 20th, 2003, 08:42 AM
netytan's Avatar
netytan netytan is offline
Hello World :)
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Mar 2003
Location: Hull, UK
Posts: 2,537 netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 2 Days 18 h 17 m 47 sec
Reputation Power: 68
Send a message via ICQ to netytan Send a message via AIM to netytan Send a message via MSN to netytan Send a message via Yahoo to netytan
Ah gotcha guys, everything up till percivall used the long words lol, seriosuly dude, is that a real word or did we just make it up

Anyway I get the whole string array thing, really isn't that hard

Thanks,
Mark.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPython Programming > open file in append mode

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap