If you want to use the print
function in Python 2, you have to import from __future__
:
from __future__ import print_function
But you can have the same effect without using the function, too:
print >>f1, 'This is a test'
More Related Contents:
- Writing a Python list of lists to a csv file
- Reading a huge .csv file
- file.tell() inconsistency
- Fastest way to process a large file?
- Is there a need to close files that have no reference to them?
- Mixing files and loops
- Sending a file over TCP sockets in Python
- How to read the last line of a file in Python? [duplicate]
- Python not able to open file with non-english characters in path
- How can I selectively escape percent (%) in Python strings?
- How to write to a CSV line by line?
- Extracting text from a PDF file using PDFMiner in python?
- Open file in a relative location in Python
- How to get the latest file in a folder?
- Simulate Python keypresses for controlling a game
- Insert a Pandas Dataframe into mongodb using PyMongo
- Unable to install Python libraries
- Recursion using yield
- How to specify where a Tkinter window opens?
- How to run different python versions in cmd [duplicate]
- Permission problems when creating a dir with os.makedirs in Python
- Using Properties in Python classes cause “maximum recursion depth exceeded” [duplicate]
- How to safely write to a file?
- Screen Capture with OpenCV and Python-2.7
- Detect duplicate MP3 files with different bitrates and/or different ID3 tags?
- pandas, melt, unmelt preserve index
- Is the right-hand side of an assignment always evaluated before the assignment?
- Jupyter | The kernel appears to have died. It will restart automatically |
- Running Scapy on Windows with Python 2.7
- How can I import files in Python using sys.path.append?