Python Forum
ValueError-trying to split a line
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ValueError-trying to split a line
#5
i try to change the line as you said but it give me en error, i should have change some values ?
Error:
Traceback (most recent call last): File "C:\Users\samue\Documents\Documents\prepa\PT\tipe\expérimentation\releves\moyenne_val_triée.py", line 19, in <module> print('length: {}, ligne: {}',format(len(ligne),ligne)) ValueError: Invalid format specifier
the code
with open("data.txt","r") as f:
    for i in f:
        for _ in range(10):
            ligne=f.readline()
            print(ligne)
            ligne.strip().split("\t")
            print('length: {}, ligne: {}',format(len(ligne),ligne))
            t,h,Text,Tint,lux = ligne
Reply


Messages In This Thread
ValueError-trying to split a line - by samu3l - Feb-05-2018, 09:48 PM
RE: ValueError-trying to split a line - by Larz60+ - Feb-05-2018, 10:10 PM
RE: ValueError-trying to split a line - by samu3l - Feb-05-2018, 10:49 PM
RE: ValueError-trying to split a line - by Larz60+ - Feb-06-2018, 12:41 AM
RE: ValueError-trying to split a line - by samu3l - Feb-06-2018, 11:52 AM
RE: ValueError-trying to split a line - by buran - Feb-06-2018, 12:09 PM
RE: ValueError-trying to split a line - by samu3l - Feb-06-2018, 12:17 PM
RE: ValueError-trying to split a line - by Larz60+ - Feb-06-2018, 07:28 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  split the line fixed length tokens bb8 5 5,733 Nov-25-2017, 06:18 PM
Last Post: heiner55
  How to access each line in for loop and split string SriRajesh 2 3,213 Aug-14-2017, 06:05 PM
Last Post: tetrmnot

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020