导航

    • 登录
    • 搜索
    • 版块
    • 产品
    • 教程
    • 论坛
    • 淘宝
    1. 主页
    2. rgim
    R
    • 举报资料
    • 资料
    • 关注
    • 粉丝
    • 屏蔽
    • 帖子
    • 楼层
    • 最佳
    • 群组

    rgim

    @rgim

    0
    声望
    6
    楼层
    706
    资料浏览
    0
    粉丝
    0
    关注
    注册时间 最后登录

    rgim 关注

    rgim 发布的帖子

    • txt文件读写问题:以下函数写出来的东西没有换行,且第二次运行并没有在后面追加,而是覆盖了之前的,为什么?

      temp=[12,45,78]
      i=1
      while True:
      if i==1:
      w=open('data_base.txt','+')
      te=str(temp[0])+' '+str(temp[1])+' '+str(temp[2])+'\n'
      w.write('\n'+te+'\n')
      w.write('\n')
      w.write('\n'+te+'\n')
      w.write('\n')
      w.write('\n'+te+'\n')
      w.write('\n')
      w.close()
      i=0
      print('运行结束了')
      0_1542296154007_123.jpg

      发布在 OpenMV Cam
      R
      rgim
    • txt读写问题:调用以下函数,写在TXT里面的东西没有换行,请问为什么?

      @kidswong999

      def write():
      w=open('data_base.txt','a')
      te=str(temp_L_0[0])+' '+str(temp_L_0[1])+' '+str(temp_L_0[2])+'\n'
      w.write(te)
      w.write('\n')
      print(te)
      print('\n')
      w.close()
      
      发布在 OpenMV Cam
      R
      rgim
    • RE: 写入txt问题:txt文件,里面写了456,运行下面代码,可以读出456,但是写入不了东西.请问该怎么办?

      @kidswong999
      def write():
      w=open('data_base.txt','a')
      te=str(temp_L_0[0])+' '+str(temp_L_0[1])+' '+str(temp_L_0[2])+'\n'
      w.write(te)
      w.write('\n')
      print(te)
      print('\n')
      w.close()

      发布在 OpenMV Cam
      R
      rgim
    • RE: 写入txt问题:txt文件,里面写了456,运行下面代码,可以读出456,但是写入不了东西.请问该怎么办?

      @kidswong999 谢谢上面的回答,现在能写进去了,但是我调用一下函数,写进去的东西并不能换行,请问是什么原因呢

      发布在 OpenMV Cam
      R
      rgim
    • 写入txt问题:txt文件,里面写了456,运行下面代码,可以读出456,但是写入不了东西.请问该怎么办?
      c=open('2.txt','+')
      i=0
      while(True):
          if i==0:
              c=open('2.txt','+')
              a=c.read()
              print(a)
              c.write('123')
              c.close() 
              print('程序运行了')
              i=1
      

      0_1542276241931_2018-11-15_180342.jpg

      发布在 OpenMV Cam
      R
      rgim