我正在尝试读取一个包文件而我只使用空格而不是制表符但是当我运行我的python代码时出现错误:
from __future__ import print_function
import rosbag
bag = rosbag.Bag('2016-06-06-12-57-11.bag')
for topic, msg, t in bag.read_messages(topics=['/base_scan']):
for (msg.min.ranges[i], msg.max.ranges[i]):
print("%f " % (msg.ranges[i]))
bag.close()
打印前我有4个空格(...)。我究竟做错了什么 ?
答案 0 :(得分:0)
外部for循环的内容也需要4个空格:
from __future__ import print_function
import rosbag
bag = rosbag.Bag('2016-06-06-12-57-11.bag')
for topic, msg, t in bag.read_messages(topics=['/base_scan']):
for (msg.min.ranges[i], msg.max.ranges[i]):
print("%f " % (msg.ranges[i]))
bag.close()