Skip to main content
Filter by
Sorted by
Tagged with
2452 votes
36 answers
3.4m views

In Java, arrays don't override toString(), so if you try to print one directly, you get the className + '@' + the hex of the hashCode of the array, as defined by Object.toString(): int[] intArray = ...
Alex Spurling's user avatar
1636 votes
14 answers
1.2m views

How do I force Python's print function to flush the buffered output to the screen? See also: Disable output buffering if the goal is to change the buffering behaviour generally. This question is ...
Walter Nissen's user avatar
851 votes
13 answers
1.5m views

When I try to print an instance of a class, I get an output like this: >>> class Test(): ... def __init__(self): ... self.a = 'foo' ... >>> print(Test()) <__main__....
Ashwin Nanjappa's user avatar
703 votes
23 answers
743k views

Is it possible to print HTML pages with custom headers and footers on each printed page? I'd like to add the word "UNCLASSIFIED" in Red, Arial, size 16pt to the top and bottom of every printed page, ...
user avatar
567 votes
37 answers
1.0m views

How do I print the indicated div (without manually disabling all other content on the page)? I want to avoid a new preview dialog, so creating a new window with this content is not useful. The page ...
noesgard's user avatar
  • 6,199
528 votes
16 answers
813k views

Are there situations in which sys.stdout.write() is preferable to print? (Examples: better performance; code that makes more sense)
Johanna Larsson's user avatar
425 votes
30 answers
1.9m views

Is it possible write a string or log into the console? What I mean Just like in JSP, if we print something like system.out.println("some"), it will be there at the console, not at a page.
Labeeb Panampullan's user avatar
394 votes
14 answers
1.3m views

I have some code like: score = 100 name = 'Alice' print('Total score for %s is %s', name, score) I want it to print out Total score for Alice is 100, but instead I get Total score for %s is %s Alice ...
user1985351's user avatar
  • 4,719
374 votes
10 answers
509k views

I am using iPython notebook. When I do this: df I get a beautiful table with cells. However, if i do this: df1 df2 it doesn't print the first beautiful table. If I try this: print df1 print df2 ...
Chris's user avatar
  • 13.8k
324 votes
18 answers
573k views

I have a HTML report, which needs to be printed landscape because of the many columns. It there a way to do this, without the user having to change the document settings? And what are the options ...
doekman's user avatar
  • 19.4k
321 votes
13 answers
514k views

I have a project which requires printing an HTML table with many rows. My problem is the way the table is printed over multiple page. It will sometimes cut a row in half, making it unreadable because ...
h3.'s user avatar
  • 11.1k
309 votes
7 answers
149k views

I'm attempting to customize the print CSS, and finding that it prints links out with the href value as well as the link. This is in Chrome. For this HTML: <a href="http://www.google.com">...
Chris Gratigny's user avatar
289 votes
18 answers
755k views

E.g: print "hello" What should I do to make the text "hello" bold?
Jia-Luo's user avatar
  • 3,323
269 votes
13 answers
596k views

I've got a javascript object which has been JSON parsed using JSON.parse I now want to print the object so I can debug it (something is going wrong with the function). When I do the following... for (...
Skizit's user avatar
  • 45.1k
257 votes
10 answers
489k views

How can I print a pandas dataframe as a nice text-based table, like the following? +------------+---------+-------------+ | column_one | col_two | column_3 | +------------+---------+-------------+ ...
Ofer's user avatar
  • 3,193
250 votes
9 answers
684k views

Is there a way to print text and variable contents on the same line? For example, wd <- getwd() print("Current working dir: ", wd) I couldn't find anything about the syntax that would allow me to ...
user avatar
244 votes
15 answers
316k views

In python, if I say print 'h' I get the letter h and a newline. If I say print 'h', I get the letter h and no newline. If I say print 'h', print 'm', I get the letter h, a space, and the letter ...
Bart's user avatar
  • 11k
216 votes
22 answers
318k views

How can I print a binary tree in Java so that the output is like: 4 / \ 2 5 My node: public class Node<A extends Comparable> { Node<A> left, right; A data; public ...
Tian's user avatar
  • 2,473
210 votes
7 answers
89k views

I've always been amazed/frustrated with how long it takes to simply output to the terminal with a print statement. After some recent painfully slow logging I decided to look into it and was quite ...
Russ's user avatar
  • 11.4k
203 votes
10 answers
300k views

I have seen this question asked in a couple of different ways on SO and several other websites, but most of them are either too specific or out-of-date. I'm hoping someone can provide a definitive ...
Anthony's user avatar
  • 37.2k
194 votes
11 answers
412k views

I keep printing my hash as # of buckets / # allocated. How do I print the contents of my hash? Without using a while loop would be most preferable (for example, a one-liner would be best).
Kys's user avatar
  • 2,645
175 votes
7 answers
417k views

I am using a separate style-sheet for printing. Is it possible to set right and left margins in the style-sheet which set the print margin? (i.e. margin on paper)
kobra's user avatar
  • 4,973
165 votes
9 answers
304k views

I'm using Twitter-Bootstrap and I need to be able to print the page the way it looks on the browser. I'm able to print other pages made with Twitter-Bootstrap just fine but I can't seem to print my ...
Jay Q.'s user avatar
  • 5,009
161 votes
6 answers
870k views

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 ...
Debiprasad's user avatar
  • 6,243
157 votes
9 answers
381k views

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 ...
plahstic's user avatar
  • 1,621

1
2 3 4 5
465