The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Programming Languages
> Python Programming
|
Page 2 -
open file in append mode
Page 2 - Discuss open file in append mode in the Python Programming forum on Dev Shed. open file in append mode Python Programming forum discussing coding techniques, tips and tricks, and Zope related information. Python was designed from the ground up to be a completely object-oriented programming language.
|
|
 |
|
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

August 19th, 2003, 08:16 PM
|
|
Contributing User
|
|
Join Date: Aug 2003
Location: Brisbane, Australia
Posts: 50
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?
|

August 19th, 2003, 09:18 PM
|
 |
Hello World :)
|
|
Join Date: Mar 2003
Location: Hull, UK
|
|
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.
|

August 20th, 2003, 12:24 AM
|
|
Contributing User
|
|
Join Date: Aug 2003
Location: Brisbane, Australia
Posts: 50
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']
|

August 20th, 2003, 01:15 AM
|
|
Contributing User
|
|
Join Date: Jul 2003
Posts: 133
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.

|

August 20th, 2003, 08:42 AM
|
 |
Hello World :)
|
|
Join Date: Mar 2003
Location: Hull, UK
|
|
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.
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|