I have many list containing thousands of line of data. I want to merge those list side by side in a .dat file like this 1::2::F::4::990
. Consider these single data as different list I want to merge the data exactly as this. Can you help
I have done this so far.
with open("mergefile.dat", "w") as outfile:
outfile.write("\n".join(users_id)+'::'+'\n'.join(movie_id)+'::'+'\n'.join(ratings)+'::'+'\n'.join(timestamps)+'::'+'\n'.join(genders)+'::'+'\n'.join(age)+'::'+'\n'.join(occupation)+'::'+'\n'.join(zipp)+'::'+'\n'.join(moviename)+'::'+'\n'.join(yearOfMovie))
I want to merge data like this and i have list like user_id, movie_id, ratings, etc each column is a list
this is how my list looks like
These are my sample lists
user_id=['1','2', '3','4', '5','6','7']
movie_id=['1246','1247', '2081', '1240', '714']
ratings=['5','6','2','7']
timestamp=['9999','0000','5555','2222','1111']
gender=['F','G','F','F','G']
age=['1','1','2']
occupation=['10','10','10','10','10','10']
zip=['67890','45600']
title=['titl1','title2']
genres=['genre1','genre2','genre3']
year=['1999','1990']
i have tried this and didn't got what i want
for user,movie,rating,timestamp,gender,age,occupations,zipps,title,genre,year in zip(users_id,movies_id,ratings,timestamps,genders,age,occupation,zipp,moviename,genres,yearOfMovie):
with open("mergefile1.dat", "w") as outfile:
outfile.write(user+'::'+movie+'::'+rating+'::'+timestamp+'::'+gender+'::'+age+'::'+occupations+'::'+zipps+'::'+title+'::'+genre+'::'+year)
this is my output only one line
1::1246::4::978302091::F::1::1::48067::Toy Story::Animation|Children's|Comedy::1995