I cant understand one detail in opening CSV, JSON in python

when i print output of code i always get this unreadable data cant anyone help me please?

<_io.TextIOWrapper name=‘passwords.csv’ mode=‘w’ encoding=‘UTF-8’>

import csv 
new_list = ['compromised_users']
with open('passwords.csv', 'w') as password_file:
  file = password_file 

Hacking The Fender


Hi there.

What you’re seeing is Python’s representation of the object in memory. When you use open('filename'), this creates a file object.

You can’t just dump that object to the console and expect the contents of the file to come pouring out; you need to use one of the methods provided by the file object to manipulate the content. :slight_smile:

Edit: That’s a fun project, that one. :slight_smile: