php
iphone
c
ajax
mysql
xcode
regex
objective-c
visual-studio
multithreading
eclipse
json
perl
algorithm
facebook
tsql
apache
mvc
asp
dom
Use csv with an appropriate Dialect.
csv
Dialect
Use the csv module with the excel-tab dialect:
excel-tab
>>> import csv >>> with open('sample.txt', 'w') as f: ... w = csv.writer(f, dialect = 'excel-tab') ... w.writerows(sample_mod) ...
After I ran this code with your sample_mod list the file 'sample.txt' contained:
sample_mod
age 1 births 2 cars 3 foods 4 set 10 grm 6
which is the desired result.
You could also try converting the integers to strings first. Check out this page: http://www.daniweb.com/software-development/python/threads/93655