On Wed, Mar 2, 2011 at 11:46 PM, ESKalaiyarasan
<[hidden email]> wrote:
> I am Kalaiyarasan.I am doing my graduate degree in anna university
> chennai.I am using python pylab for my project.
> in matlab we can get input from user using x=input() command similarly in
> python we use x=raw_input() command
> but i want to how to know size of data, in matlab we use size(x) command
> return size (example 3 X 2). what is command for python?
> please help me.
> SciPy-User mailing list
> [hidden email] > http://mail.scipy.org/mailman/listinfo/scipy-user >
On Thu, Mar 3, 2011 at 2:16 PM, ESKalaiyarasan <[hidden email]> wrote:
hi, I am Kalaiyarasan.I am doing my graduate degree in anna university chennai.I am using python pylab for my project.
in matlab we can get input from user using x=input() command similarly in python we use x=raw_input() command
Hello Kalaiyarasan, This is an information about raw_input function( I strongly recommend you to switch to IPython if you are not using it yet). The point I would like to highlight is that, raw input returns the *string* and hence may not be very useful if you are looking for an matrix input.
In : raw_input? Type: builtin_function_or_method Base Class: <type 'builtin_function_or_method'> String Form: <built-in function raw_input> Namespace: Python builtin
Docstring: raw_input([prompt]) -> string
Read a string from standard input. The trailing newline is stripped. If the user hits EOF (Unix: Ctl-D, Windows: Ctl-Z+Return), raise EOFError.
On Unix, GNU readline is used if enabled. The prompt string, if given, is printed without a trailing newline before reading.
but i want to how to know size of data, in matlab we use size(x) command return size (example 3 X 2). what is command for python?
And with the sting you can always use len(a) function to know the length of string.
In : a = raw_input() 343
In : type(a) Out: <type 'str'>
In : len(a) Out: 3
The additional tool I know in this regard is
In : a = int(raw_input())
In : type(a) Out: <type 'int'>
Hope this will help you a bit. But I am not an expert here so there is a good chance that someone else can give you better answer.
please help me.
For the rest of group, kindly save me from misguiding him if I am not right.