ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
I'm assuming that you mean
rospy.loginfo("Config set to {int_param}, {double_param}, {str_param}, {bool_param}, {size}".format(**config))
This is just plain Python. From the Python docs
format(format_string, *args, **kwargs)
The primary API method. It takes a format string and an arbitrary set of positional and keyword arguments. It is just a wrapper that calls
vformat()
.
As for the **config
, checkout this answer on StackOverlfow:
This is a shortcut that allows you to pass multiple arguments to a function directly using either a list/tuple or a dictionary.
As for using it with numpy
, I'm not too familiar with numpy
but I don't believe that you do. But, you should ask a new question about that specifically.
2 | No.2 Revision |
I'm assuming that you mean
rospy.loginfo("Config set to {int_param}, {double_param}, {str_param}, {bool_param}, {size}".format(**config))
This is just plain Python. From the Python docs
format(format_string, *args,str.format(*args, **kwargs)Perform a string formatting operation. The
primary API method. It takes a format string and an arbitrary set ofstring on which this method is called can contain literal text or replacement fields delimited by braces {}. Each replacement field contains either the numeric index of a positionalandargument, or the name of a keywordarguments. It is just a wrapper that callsargument. Returns a copy of the string where each replacement field is replaced with the string value of the corresponding argument.vformat()
.
As for the **config
, checkout this answer on StackOverlfow:
This is a shortcut that allows you to pass multiple arguments to a function directly using either a list/tuple or a dictionary.
As for using it with numpy
, I'm not too familiar with numpy
but I don't believe that you do. But, you should ask a new question about that specifically.
3 | No.3 Revision |
I'm assuming that you mean
rospy.loginfo("Config set to {int_param}, {double_param}, {str_param}, {bool_param}, {size}".format(**config))
This is just plain Python. From the Python docs
str.format(*args, **kwargs)
Perform a string formatting operation. The string on which this method is called can contain literal text or replacement fields delimited by braces
{}.{}
. Each replacement field contains either the numeric index of a positional argument, or the name of a keyword argument. Returns a copy of the string where each replacement field is replaced with the string value of the corresponding argument.
As for the **config
, checkout this answer on StackOverlfow:
This is a shortcut that allows you to pass multiple arguments to a function directly using either a list/tuple or a dictionary.
As for using it with numpy
, I'm not too familiar with numpy
but I don't believe that you do. But, you should ask a new question about that specifically.