【CSEN026】CS Robot Using Script to read and write txt file

This idea requires the software version to be 2.5 or above.

To create a file under the default folder that stores all task program (program), function get_task_path can be used for taking the task path.

In the sample below, a file named 16.txt will be create. 

Then the for loop will write number 0 to 10 in the txt file. Each number will be in different row since there also a "\n" written to the txt file. 


To read data, use f.read

The sample below will save the data read to variable x.

x = f.read
点击显示全文
赞同0
发表评论
分享

手机扫码分享
0
209
收藏
举报
收起
登录
  • 密码登录
  • 验证码登录
还没有账号,立即注册
还没有账号,立即注册
注册
已有账号,立即登录
选择发帖板块
举报
请选择举报理由
举报
举报说明