[SciPy-User] ERROR : while finding size
Thu Mar 3 03:17:53 CST 2011
On Thu, Mar 3, 2011 at 2:16 PM, ESKalaiyarasan <email@example.com>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
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?
Base Class: <type 'builtin_function_or_method'>
String Form: <built-in function raw_input>
Namespace: Python builtin
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
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
In : a = raw_input()
In : type(a)
Out: <type 'str'>
In : len(a)
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
> SciPy-User mailing list
Whenever you think you can or you can't, in either way you are right.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the SciPy-User