1读文件:
file_path_name = ‘/home/robot/bzrobot_ws/src/bzrobot/bzrobot_comm/led_show_data/‘+file_name+‘.txt‘
open_file = open(led_file_path_name, ‘r‘)
data_read_file = open_file.read(4096)
2.写文件:
sys_time = rospy.get_time()
desk_path_name = ‘/home/wang/Desktop‘ (ubuntu的桌面路径)
write_file = open(led_file_path_name, ‘w‘)
write_file.write(str(sys_time))
时间: 2024-10-13 15:37:43