![]() ![]() Which I want to end up looking like this: 65īut so far the script only appends my 2 variables to the end of the. Print("print 2 lines right before this line")Īnd this is the test. New_data = str(new_num) '\n' 'Georph' txt for the 1st number that is >= to my integer variable and then I want to write my integer and name above the found number (I need them on a new line, and each variable on a separate line). Python Write To File Line By Line Using writelines () and For Loop: lines 'line1', 'line2','line3' fopen ('devops.txt', 'a') f.writelines ('s ' i for i in lines) f. I then have 2 variables, an integer and a name. txt with alternating names and numbers (the numbers ordered from lowest to highest).
0 Comments
Leave a Reply. |