Questions tagged [printing]

Printing is a process for reproducing text and images, typically with ink or toner, on paper. For programming questions related to 3D-printing, please, use [3d-printing] tag.

Printing is a process for reproducing text and images. Both ink and toner are commonly used, with the latter being used for laser printers.

It can also refer to printing text to stdout on a terminal, e.g., the printf function in C or the print construct in PHP.

For programming questions related to 3D-printing, general questions can be asked on https://3dprinting.stackexchange.com/.

23212 questions
161
votes
6 answers

Loop a multidimensional array and only print two specific column values per row

How can I print the filepath and filename values from each row? Array ( [0] => Array ( [fid] => 14 [list] => 1 [data] => Array ( [alt] => [title] => …
esafwan
  • 17,311
  • 33
  • 107
  • 166
157
votes
9 answers

TypeError: cannot concatenate 'str' and 'int' objects

I have this python program that adds strings to integers: a = raw_input("Enter a: ") b = raw_input("Enter b: ") print "a + b as strings: " + a + b a = int(a) b = int(b) c = a + b str(c) print "a + b as integers: " + c I get this error: TypeError:…
plahstic
  • 1,621
  • 2
  • 11
  • 7
156
votes
13 answers

How can I force browsers to print background images in CSS?

This question was asked before but the solution is not applicable in my case. I want to make sure certain background images are printed because they are integral to the page. (They are not images directly in the page because there are several of…
DisgruntledGoat
  • 70,219
  • 68
  • 205
  • 290
154
votes
15 answers

Remove header and footer from window.print()

I am using window.print() for printing page, but I got header and footer contains page title, file path, page number and date. How to remove them? I tried print stylesheet also. #header, #nav, .noprint { display: none; } Please help. Thanks.
Viralk
  • 2,299
  • 4
  • 23
  • 27
152
votes
4 answers

Is it possible to "hack" Python's print function?

Note: This question is for informational purposes only. I am interested to see how deep into Python's internals it is possible to go with this. Not very long ago, a discussion began inside a certain question regarding whether the strings passed to…
cs95
  • 379,657
  • 97
  • 704
  • 746
150
votes
6 answers

How to print HTML content on click of a button, but not the page?

I want to print some HTML content, when the user clicks on a button. Once the user clicks on that button, the print dialog of the browser will open, but it will not print the webpage. Instead, it will print the some other HTML content which is not…
Debiprasad
  • 5,895
  • 16
  • 67
  • 95
148
votes
5 answers

Python: avoid new line with print command

When I use the print command, it prints whatever I want and then goes to a different line. For example: print "this should be"; print "on the same line" Should return: this should be on the same line but instead returns: this should be on the…
Javicobos
  • 1,485
  • 2
  • 10
  • 6
143
votes
13 answers

Pythonic way to print list items

I would like to know if there is a better way to print all objects in a Python list than this : myList = [Person("Foo"), Person("Bar")] print("\n".join(map(str, myList))) Foo Bar I read this way is not really good : myList = [Person("Foo"),…
Guillaume Voiron
  • 1,785
  • 2
  • 15
  • 16
140
votes
9 answers

GDB print to file instead of stdout

I am running GDB and want to examine one of those unfortunate god objects. It takes many pages (and I have a 24" monitor turned sideways!) to see the whole thing. For ease of use, I'd like GDB to print the object to a file instead of the screen so…
pythonic metaphor
  • 10,296
  • 18
  • 68
  • 110
133
votes
15 answers

How to block calls to print?

Is there a way to stop a function from calling print? I am using the pygame.joystick module for a game I am working on. I created a pygame.joystick.Joystick object and in the actual loop of the game call its member function get_button to check for…
dmlicht
  • 2,328
  • 2
  • 15
  • 16
132
votes
1 answer

Print styles: How to ensure image doesn't span a page break

When writing a print stylesheet, is there a way to ensure that an image is always only on a single page, instead of spanning multiple pages. The images much smaller than the page, but based on the document flow, they end up at the bottom of the page…
davidtbernal
  • 13,434
  • 9
  • 44
  • 60
131
votes
23 answers

How to remove the URL from the printing page?

I want to remove the URL that gets printed on the bottom of the page. like: yomari.com/.../main.php?sen_n How can it be omitted or prevent from getting printed? To be more specific, is there any way I can prevent the page URL, date and the page…
jarus
131
votes
6 answers

Is there a portable way to print a message from the C preprocessor?

I would like to be able to do something like #print "C Preprocessor got here!" for debugging purposes. What's the best / most portable way to do this?
Andrew Wagner
  • 22,677
  • 21
  • 86
  • 100
127
votes
5 answers

What are the minimum margins most printers can handle?

Im creating pdfs server side with lots of graphics so maximizing real estate is a must but at the same time ensuring users printers can handle the tight margins is a must. Does anyone have an idea what safe values I can use for the margins when…
robodisco
  • 4,162
  • 7
  • 34
  • 48
127
votes
8 answers

Confused about __str__ on list in Python

Coming from a Java background, I understand that __str__ is something like a Python version of toString (while I do realize that Python is the older language). So, I have defined a little class along with an __str__ method as follows: class Node: …
Christofer Ohlsson
  • 3,097
  • 4
  • 39
  • 56