Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python print file

import sys

# only this print call will write in the file
print("Hello Python!", file=open('output.txt','a'))

# not this one (std output)
print("Not written")

# any further print will be done in the file
sys.stdout = open('output.txt','wt')
print("Hello Python!")
Comment

print file in python

GHOSTSCRIPT_PATH = "C:path	oGHOSTSCRIPTingswin32.exe"
GSPRINT_PATH = "C:path	oGSPRINTgsprint.exe"

# YOU CAN PUT HERE THE NAME OF YOUR SPECIFIC PRINTER INSTEAD OF DEFAULT
currentprinter = win32print.GetDefaultPrinter()

win32api.ShellExecute(0, 'open', GSPRINT_PATH, '-ghostscript "'+GHOSTSCRIPT_PATH+'" -printer "'+currentprinter+'" "PDFFile.pdf"', '.', 0)
Comment

PREVIOUS NEXT
Code Example
Python :: python calculate computation time 
Python :: how to create correlation heatmap in python 
Python :: record video with python 
Python :: pip install speedtest 
Python :: first position dict python 
Python :: extract ints from strings in Pandas 
Python :: pil get image size 
Python :: how to draw image in tkinter 
Python :: brownie from wei to ether 
Python :: godot white shader 
Python :: create virtualenv in pythonanywhere 
Python :: unban discord.py 
Python :: install wxpython 
Python :: file exist python 
Python :: np.save function 
Python :: python print in color 
Python :: cv2 save video mp4 
Python :: draw heart with python 
Python :: pandas add character to string 
Python :: python print code 
Python :: tensorflow turn off gpu 
Python :: python random.choices vs random.sample 
Python :: email validation python 
Python :: linear search in python 
Python :: marks input using list in python 
Python :: insert picture into jupyter notebook 
Python :: pyttsx3 pip 
Python :: change background color of tkinter 
Python :: how to count stopwords in df 
Python :: join two numpy 2d array 
ADD CONTENT
Topic
Content
Source link
Name
5+1 =