so i'm working on coursework task school (in python 3.5.1). 1 of tasks have user input unique code , search through document , print whole line code in. if put in "e5341" print out "e5341,21/09/2015,c102,440,e,0". have works great.
def optiona(): estimatenumber = input ("please enter estimate number") handle = open ("paintingjobs.txt") line in handle: if line.startswith(estimatenumber) : print (line)
however, need print out line in list in format (minus bullet points. they're there separate each line)
- estimate number:
- estimate date:
- customer id:
- status
- estimate amount:
and have no clue how so. gratefully appreciated. way, after each comma in "e5341,21/09/2015,c102,440,e,0" new list heading. e5341 being estimate number, 21/09/2015 estimate date etc.
since working in school coursework not give code directions.
if attributes in line returned comma separated should use 'split' function in python. refer documentation learn how use it. if want print line line append newline character each member of output of split function (instead of looping try using 'map' function task, may end learning thing or 2 :-) ).
Comments
Post a Comment