Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I am trying to output a full for iteration. The output should be in a text file. How should I code for that ?

The output should look like :

Iteration 1 values --------> val1 < tab > val2 < tab > val3

Iteration 2 values --------> val4 < tab > val5 < tab > val6

This is not much of an information but I don't know where to start , can any1 show me plz ?? At the basic how should I open a text file and try and write using tabs ??

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
655 views
Welcome To Ask or Share your Answers For Others

1 Answer

numbers = [1,2,3,4,5,6]

with open('output.txt', 'w') as f:
  f.write('	'.join(numbers))

Not really sure what else you mean


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...