Page 2 of 2 First 12
  • Jump to page:
    #16
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Location
    Brisbane, Australia
    Posts
    50
    Rep Power
    11
    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?
  2. #17
  3. Hello World :)
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2003
    Location
    Hull, UK
    Posts
    2,537
    Rep Power
    69
    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.
  4. #18
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Location
    Brisbane, Australia
    Posts
    50
    Rep Power
    11
    thanks netytan for the muti-D list/array

    and yes, string array(list) an array(list) of string
    ['row1', 'row2', 'row3']
  6. #19
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Posts
    133
    Rep Power
    11
    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.

  8. #20
  9. Hello World :)
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2003
    Location
    Hull, UK
    Posts
    2,537
    Rep Power
    69
    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.
Page 2 of 2 First 12
  • Jump to page:

IMN logo majestic logo threadwatch logo seochat tools logo