Re: print('\N{flag: Mauritius}') not supported in py3.9

2021-12-21 Thread boB Stepp
On 21/12/22 12:14PM, Python wrote: On 30/11/2021 12.31, Cameron Simpson wrote: On 30Nov2021 10:59, DL Neil wrote: ... I've nominated Kitty as Fedora's default terminal. We'll see how it goes with work-loads beyond raising the flag... I'd like to hear how that goes down the track. If I find

Re: print('\N{flag: Mauritius}') not supported in py3.9

2021-12-21 Thread dn via Python-list
On 30/11/2021 12.31, Cameron Simpson wrote: > On 30Nov2021 10:59, DL Neil wrote: ... >> I've nominated Kitty as >> Fedora's default terminal. We'll see how it goes with work-loads beyond >> raising the flag... > > I'd like to hear how that goes down the track. If I find myself on a > Linux desk

Re: print('\N{flag: Mauritius}') not supported in py3.9

2021-11-29 Thread Cameron Simpson
On 30Nov2021 10:59, DL Neil wrote: >Fedora names it as rxvt-unicode. >Installed v9.26 >Text is too small for these old eyes. Fair enough. There are resources, but not worth it unless you really want the app. >No menu bar and no context menus. Um, yes. The (hardware, serial) terminals we had a

Re: print('\N{flag: Mauritius}') not supported in py3.9

2021-11-29 Thread dn via Python-list
On 30/11/2021 10.19, Cameron Simpson wrote: > On 29Nov2021 22:25, DL Neil wrote: Probably a font issue. Not many fonts support the flags. >>> >>> Agree about the font support. Some terminal emulators make an effort to >>> have fallback fonts for when your preferred font lacks a glyph. IIRC >>

Re: print('\N{flag: Mauritius}') not supported in py3.9

2021-11-29 Thread Cameron Simpson
On 29Nov2021 22:25, DL Neil wrote: >>> Probably a font issue. Not many fonts support the flags. >> >> Agree about the font support. Some terminal emulators make an effort to >> have fallback fonts for when your preferred font lacks a glyph. IIRC >> urxvt is such a terminal on Linux. > >Not sure ab

Re: print('\N{flag: Mauritius}') not supported in py3.9

2021-11-29 Thread dn via Python-list
On 29/11/2021 12.06, Cameron Simpson wrote: > On 29Nov2021 09:19, Chris Angelico wrote: >> On Mon, Nov 29, 2021 at 8:10 AM dn via Python-list >> wrote: >>> However, when trying the above, with our local flag in (Fedora Linux, >>> Gnome) Terminal or PyCharm's Run terminal; the two letters "N" and

Re: print('\N{flag: Mauritius}') not supported in py3.9

2021-11-28 Thread Cameron Simpson
On 29Nov2021 09:19, Chris Angelico wrote: >On Mon, Nov 29, 2021 at 8:10 AM dn via Python-list > wrote: >> However, when trying the above, with our local flag in (Fedora Linux, >> Gnome) Terminal or PyCharm's Run terminal; the two letters "N" and "Z" >> are shown with dotted-outlines. Similarly, th

Re: print('\N{flag: Mauritius}') not supported in py3.9

2021-11-28 Thread Chris Angelico
On Mon, Nov 29, 2021 at 8:10 AM dn via Python-list wrote: > However, when trying the above, with our local flag in (Fedora Linux, > Gnome) Terminal or PyCharm's Run terminal; the two letters "N" and "Z" > are shown with dotted-outlines. Similarly, the Mauritius' flag is shown > as "M" and "U". > >

Re: print('\N{flag: Mauritius}') not supported in py3.9

2021-11-28 Thread dn via Python-list
On 29/11/2021 02.18, Chris Angelico wrote: > On Mon, Nov 29, 2021 at 12:10 AM Abdur-Rahmaan Janhangeer > wrote: > > Flags are actually constructed from multiple codepoints. What you want > is to insert each codepoint separately. You can see them listed in the > second column of the table you link

Re: print('\N{flag: Mauritius}') not supported in py3.9

2021-11-28 Thread Abdur-Rahmaan Janhangeer
Greetings, But why is it so? -- https://mail.python.org/mailman/listinfo/python-list

Re: print('\N{flag: Mauritius}') not supported in py3.9

2021-11-28 Thread Chris Angelico
On Mon, Nov 29, 2021 at 12:29 AM Abdur-Rahmaan Janhangeer wrote: > > Greetings, > > I get you but why do the short names work for some and not for > others? > Which ones work? The ones that can be identified by a single codepoint? Look at the specification for Python's \N escapes. ChrisA -- htt

Re: print('\N{flag: Mauritius}') not supported in py3.9

2021-11-28 Thread Abdur-Rahmaan Janhangeer
Greetings, I get you but why do the short names work for some and not for others? Kind Regards, Abdur-Rahmaan Janhangeer about | blog github Mauritius -- https://mail.python.org/mailman/list

Re: print('\N{flag: Mauritius}') not supported in py3.9

2021-11-28 Thread Chris Angelico
On Mon, Nov 29, 2021 at 12:10 AM Abdur-Rahmaan Janhangeer wrote: > I found the whole CLDR short name here: > https://unicode.org/emoji/charts/full-emoji-list.html > > However when i do > > >>> print('\N{flag: Mauritius}') > File "", line 1 > print('\N{flag: Mauritius}') >

Re: print the output of my code in Markdown using variable (not the value)

2020-08-15 Thread Mats Wichmann
On 8/15/20 11:00 AM, Michio Suginoo wrote: > Hi, > > I am still at an early stage of my personal Python evolution. > > I am coding Python3 in Jupyter Notebook (Anaconda environment). > > I want to print the output of my code in a 'markdown'. > I want to use the variable in the 'markdown' rather

Re: print() ignores context ?

2020-05-05 Thread Greg Ewing
On 1/05/20 8:33 pm, R.Wieser wrote: getcontext().rounding=ROUND_HALF_UP print(round(1.5)) print(round(2.5)) If you're talking about getcontext() from the decimal module, that only affects operations with Decimals, not regular floats. Python doesn't provide a way to change the rounding mode fo

Re: print small DataFrame to STDOUT and read it back into dataframe

2020-04-07 Thread Luca
On 4/6/2020 11:05 PM, Luca wrote: On 4/6/2020 8:51 PM, Reto wrote: out = df.to_csv(None) new = pd.read_csv(io.StringIO(out), index_col=0) Thank you, brother. It works BTW, a little gotcha (I write this in case someone gets here in the future through Google or something) """ import pandas

Re: print small DataFrame to STDOUT and read it back into dataframe

2020-04-06 Thread Luca
On 4/6/2020 8:51 PM, Reto wrote: out = df.to_csv(None) new = pd.read_csv(io.StringIO(out), index_col=0) Thank you, brother. It works -- https://mail.python.org/mailman/listinfo/python-list

Re: print small DataFrame to STDOUT and read it back into dataframe

2020-04-06 Thread Reto
On Mon, Apr 06, 2020 at 06:29:01PM -0400, Luca wrote: > so, given a dataframe, how do I make it print itself out as CSV? read the docs of to_csv... > And given CSV data in my clipboard, how do I paste it into a Jupiter cell > (possibly along with a line or two of code) that will create a datafram

Re: print small DataFrame to STDOUT and read it back into dataframe

2020-04-06 Thread Luca
On 4/6/2020 3:03 PM, Christian Gollwitzer wrote: CSV is the most sensible option here. It is widely supported by spreadsheets etc. and easily copy/pasteable. Thank you Christian. so, given a dataframe, how do I make it print itself out as CSV? And given CSV data in my clipboard, how do I

Re: print small DataFrame to STDOUT and read it back into dataframe

2020-04-06 Thread Christian Gollwitzer
Am 06.04.20 um 17:17 schrieb Luca: On 4/6/2020 4:08 AM, Reto wrote: Does this help? Thank you, but not really. What I am trying to achieve is to have a way to copy and paste small yet complete dataframes (which may be the result of previous calculations) between a document (TXT, Word, Google

Re: print small DataFrame to STDOUT and read it back into dataframe

2020-04-06 Thread Luca
On 4/6/2020 4:08 AM, Reto wrote: Does this help? Thank you, but not really. What I am trying to achieve is to have a way to copy and paste small yet complete dataframes (which may be the result of previous calculations) between a document (TXT, Word, GoogleDoc) and Jupiter/IPython. Did I m

Re: print small DataFrame to STDOUT and read it back into dataframe

2020-04-06 Thread Reto
On Sat, Apr 04, 2020 at 07:00:23PM -0400, Luca wrote: > dframe.to_string > > gives: > > 0 a0 b0 c0 d0 > 1 a1 b1 c1 d1 > 2 a2 b2 c2 d2 > 3 a3 b3 c3 d3> That's not the output of to_string. to_string is a method, not an attribute which is apparent by the > comment in your output

Re: Print statement

2020-01-28 Thread Frank Millman
On 2020-01-28 12:14 PM, L A Smit wrote: Please help me with this. squares =input("\nSquares: ") print(float((squares) *float(.15)) *(1.3)) Cant print answer.   print(float((squares) * float(.15)) *(1.3)) TypeError: can't multiply sequence by non-int of type 'float' You have some superfluo

Re: Print formatting

2019-10-18 Thread D'Arcy Cain
On 10/18/19 5:00 PM, D'Arcy Cain wrote: Finally, if this is in a loop do this. FMT = '{0[0]:<12s}{0[3]:>12s}'.format for temp_list in GetLists(): print FMT(temp_list) Oops. Time warp. I meant "print(FMT(temp_list)) -- D'Arcy J.M. Cain Vybe Networks Inc. http://www.VybeNetworks.com/ IM:da...

Re: Print formatting

2019-10-18 Thread D'Arcy Cain
On 10/18/19 2:21 PM, Jagga Soorma wrote: I seem to have found a way to do this with the following: print('{:<12s}{:>12s}'.format((temp_list[0]),(temp_list[3]))) Still let me know if there is a better way to format this output :) I would start with removing the redundant parens. print('{:<1

Re: Print formatting

2019-10-18 Thread Jagga Soorma
I seem to have found a way to do this with the following: print('{:<12s}{:>12s}'.format((temp_list[0]),(temp_list[3]))) Still let me know if there is a better way to format this output :) Thanks, -J On Fri, Oct 18, 2019 at 10:03 AM Jagga Soorma wrote: > > Hello, > > I am new to python and try

Re: Print formatting

2019-10-18 Thread MRAB
On 2019-10-18 18:03, Jagga Soorma wrote: Hello, I am new to python and trying to write a script that outputs some data about users. I was able to write it and dump the data but can't seem to align the output in column 2 correctly. Here is what I am trying to do: -- output: user1 data1 use

Re: Print to Paper

2019-10-04 Thread Michael Torrie
On 10/4/19 8:59 AM, Daniel wrote: > How to do a code to print to paper? please post here a "Hello World" > code to be printed on paper with an inkjet. What operating system? Are you using a graphical UI toolkit or is this a command-line program you're making? -- https://mail.python.org/mailman/

Re: Print to Paper

2019-10-04 Thread Grant Edwards
On 2019-10-04, Daniel wrote: > How to do a code to print to paper? please post here a "Hello World" > code to be printed on paper with an inkjet. os.popen('lpr','w').write('Hello World\n') That's a bit old-school -- you should probably use subprocess.Popen instead. -- https://mail.pyt

Re: Print to Paper

2019-10-04 Thread Piet van Oostrum
Daniel writes: > How to do a code to print to paper? please post here a "Hello World" > code to be printed on paper with an inkjet. > Thanks > Daniel It depends on the Operating System. Python doesn't have a standard, system-independent way to print to paper. On most Unix-like systems (like my

Re: print console out to a txt or csv file

2019-02-10 Thread Peter Otten
GISDude wrote: > Hi all, > I have been working on some code to list the files of a folder that has > .pdf extension. I have the basic code to create a list, but it prints that > list to the console. I'd like my code to write a txt file that contains > that list (to later import into excel). > > #

Re: print & string formatting

2018-07-22 Thread Sharan Basappa
On Sunday, 22 July 2018 10:24:55 UTC+5:30, Cameron Simpson wrote: > On 21Jul2018 21:33, Sharan Basappa wrote: > >I get a lot confused while using print functions in Python. > > > >For example, I get the same results for the following code: > > > >str = "one two three" > > Pleasetry not to name v

Re: print & string formatting

2018-07-22 Thread Thomas Jollans
On 22/07/18 06:54, Cameron Simpson wrote: > On 21Jul2018 21:33, Sharan Basappa wrote: >> I get a lot confused while using print functions in Python. >> >> For example, I get the same results for the following code: >> >> str = "one two three" > > Pleasetry not to name variables after builtin clas

Re: print & string formatting

2018-07-21 Thread Cameron Simpson
On 21Jul2018 21:33, Sharan Basappa wrote: I get a lot confused while using print functions in Python. For example, I get the same results for the following code: str = "one two three" Pleasetry not to name variables after builtin classes ("str" is the name of Python's string class). prin

Re: print & string formatting

2018-07-21 Thread Chris Angelico
On Sun, Jul 22, 2018 at 2:53 PM, Abdur-Rahmaan Janhangeer wrote: > *Folks,I get a lot confused while using print functions in Python.For > example, I get the same results for the following code:str = "one two > three"print strprint "%s" %(str)So, what is the need to use the second > method which I

Re: print & string formatting

2018-07-21 Thread Abdur-Rahmaan Janhangeer
*Folks,I get a lot confused while using print functions in Python.For example, I get the same results for the following code:str = "one two three"print strprint "%s" %(str)So, what is the need to use the second method which I see being used in many programs I am referring to* well 1) that is more

Re: Print Failure or success based on the value of the standalone tool

2018-05-10 Thread Chris Angelico
On Fri, May 11, 2018 at 1:38 PM, Cameron Simpson wrote: > Returning to system() versus the subprocess module, there are other reasons > to prefer the subprocess module. The biggest is that os.system() runs a > shell command, a string passed to the programme /bin/sh. As such, that > string is subje

Re: Print Failure or success based on the value of the standalone tool

2018-05-10 Thread Cameron Simpson
On 11May2018 06:53, Ganesh Pal wrote: On Thu, May 10, 2018, 22:31 Rob Gaddi By not using os.system, it's been superseded for reasons exactly like yours. https://docs.python.org/3/library/subprocess.html is your friend. Can someone please help me understand this better for me with a program .

Re: Print Failure or success based on the value of the standalone tool

2018-05-10 Thread Ganesh Pal
On Thu, May 10, 2018, 22:31 Rob Gaddi > > > By not using os.system, it's been superseded for reasons exactly like > yours. https://docs.python.org/3/library/subprocess.html is your friend. > Can someone please help me understand this better for me with a program . Will the returncode of subproc

Re: Print Failure or success based on the value of the standalone tool

2018-05-10 Thread Rob Gaddi
On 05/10/2018 09:48 AM, Ganesh Pal wrote: I have to test a standalone tool from a python script and I am using os.system() to run the tool . I need to take decision based on the return value of the standalone tool . But since os.system merely throws the output value to STDOUT & returns the exit

Re: print without ()

2017-09-06 Thread Glenn Hutchings
On Thursday, 7 September 2017 07:14:57 UTC+1, Andrej Viktorovich wrote: > Sometimes I find code with strange print function usage. String is passed > without brackets. > > #!/usr/bin/python > list = ['physics', 'chemistry', 1997, 2000]; > print "Value available at index 2 : " > print list[2] > l

Re: print without ()

2017-09-06 Thread Jan Erik Moström
On 7 Sep 2017, at 8:14, Andrej Viktorovich wrote: If I use command print "aaa" in console I get error. So, why this is allowed in sample? You're probably using Python 2 for the listed script and Python 3 when you try in the console. = jem -- https://mail.python.org/mailman/listinfo/python-l

Re: print odd numbers of lines from tekst WITHOUT space between lines

2017-02-19 Thread breamoreboy
On Saturday, February 18, 2017 at 6:03:37 PM UTC, Wildman wrote: > On Sat, 18 Feb 2017 09:38:32 -0800, TTaglo wrote: > > > i = 1 > > f = open ('rosalind_ini5(1).txt') > > for line in f.readlines(): > > if i % 2 == 0: > > print line > > i += 1 > > > > > > How do i get output witho

Re: print odd numbers of lines from tekst WITHOUT space between lines

2017-02-18 Thread Peter Otten
TTaglo wrote: > i = 1 > f = open ('rosalind_ini5(1).txt') > for line in f.readlines(): > if i % 2 == 0: > print line > i += 1 > > > How do i get output without breaks between the lines? I'm late to the show, but here are a few unsolicited remarks to your code. (1) The best way

Re: print odd numbers of lines from tekst WITHOUT space between lines

2017-02-18 Thread TTaglo
Op zaterdag 18 februari 2017 18:55:46 UTC+1 schreef boB Stepp: > On Sat, Feb 18, 2017 at 11:38 AM, TTaglo wrote: > > i = 1 > > f = open ('rosalind_ini5(1).txt') > > for line in f.readlines(): > > if i % 2 == 0: > > print line > > i += 1 > > > > > > How do i get output without break

Re: print odd numbers of lines from tekst WITHOUT space between lines

2017-02-18 Thread TTaglo
Op zaterdag 18 februari 2017 18:38:43 UTC+1 schreef TTaglo: > i = 1 > f = open ('rosalind_ini5(1).txt') > for line in f.readlines(): > if i % 2 == 0: > print line > i += 1 > > > How do i get output without breaks between the lines? > > Result: > > Other things just make you swea

Re: print odd numbers of lines from tekst WITHOUT space between lines

2017-02-18 Thread Wildman via Python-list
On Sat, 18 Feb 2017 09:38:32 -0800, TTaglo wrote: > i = 1 > f = open ('rosalind_ini5(1).txt') > for line in f.readlines(): > if i % 2 == 0: > print line > i += 1 > > > How do i get output without breaks between the lines? > > Result: > > Other things just make you swear and cur

Re: print odd numbers of lines from tekst WITHOUT space between lines

2017-02-18 Thread alister
On Sat, 18 Feb 2017 11:55:34 -0600, boB Stepp wrote: > On Sat, Feb 18, 2017 at 11:38 AM, TTaglo wrote: >> i = 1 f = open ('rosalind_ini5(1).txt') >> for line in f.readlines(): >> if i % 2 == 0: >> print line >> i += 1 >> >> >> How do i get output without breaks between the lines?

Re: print odd numbers of lines from tekst WITHOUT space between lines

2017-02-18 Thread boB Stepp
On Sat, Feb 18, 2017 at 11:38 AM, TTaglo wrote: > i = 1 > f = open ('rosalind_ini5(1).txt') > for line in f.readlines(): > if i % 2 == 0: > print line > i += 1 > > > How do i get output without breaks between the lines? If you use "print line," (Note the trailing comma.), this sho

Re: print() with no newline

2016-12-18 Thread ElChino
Chris Warrick wrote: >> I'm getting a syntax error in Python2. Python3 is fine. >> How can I make this Py2+3 compatible? > > With a __future__ import, the Python 3 syntax will work with both Pythons: > > from __future__ import print_function > print(s, end="") Thanks. Lovely. -- https://mail

Re: print() with no newline

2016-12-18 Thread Chris Warrick
On 18 December 2016 at 13:25, ElChino wrote: > In this snippet: > import sys > PY3 = (sys.version_info[0] >= 3) > > def print_no_nl (s): > if PY3: > print (s, end="") > else: > print (s), > > I'm getting a syntax error in Python2. Python3 is fine. > How can I make this Py

Re: print to previous line in console

2016-10-03 Thread Adam M
On Monday, October 3, 2016 at 12:46:41 PM UTC-4, Skip Montanaro wrote: > On Mon, Oct 3, 2016 at 10:23 AM, udhay prakash pethakamsetty > > Hi skip, > > > > I am unable to even install that curses package > > > > > > C:\>pip install curses > > Collecting curses > > Could not find a version that sat

Re: print to previous line in console

2016-10-03 Thread Skip Montanaro
On Mon, Oct 3, 2016 at 10:23 AM, udhay prakash pethakamsetty wrote: > Hi skip, > > I am unable to even install that curses package > > > C:\>pip install curses > Collecting curses > Could not find a version that satisfies the requirement curses (from > versions: ) > No matching distribution foun

Re: print to previous line in console

2016-10-03 Thread Skip Montanaro
> When we are printing to the console, is there a way to display to the > previous line in the console. Check out the curses module: https://docs.python.org/3.6/library/curses.html Skip -- https://mail.python.org/mailman/listinfo/python-list

Re: Print function not working

2016-08-11 Thread Michael Selik
On Thu, Aug 11, 2016 at 1:38 PM MRAB wrote: > On 2016-08-11 18:18, Chris Angelico wrote: > > On Fri, Aug 12, 2016 at 3:03 AM, Atri Mahapatra > > wrote: > >> I have installed IDLE 3.5.1 and wrote the following to check if print > is working. When it runs, I do not see anything is printed: > >> >

Re: Print function not working

2016-08-11 Thread MRAB
On 2016-08-11 18:18, Chris Angelico wrote: On Fri, Aug 12, 2016 at 3:03 AM, Atri Mahapatra wrote: I have installed IDLE 3.5.1 and wrote the following to check if print is working. When it runs, I do not see anything is printed: class Base: #{ def __init__( self ): #{ print("Hello

Re: Print function not working

2016-08-11 Thread Peter Otten
Atri Mahapatra wrote: > I have installed IDLE 3.5.1 and wrote the following to check if print is > working. When it runs, I do not see anything is printed: > > class Base: #{ > def __init__( self ): #{ > print("Hello, world: \n\n"); > > #} > > #} > > > if ( __name__ =

Re: Print function not working

2016-08-11 Thread Chris Angelico
On Fri, Aug 12, 2016 at 3:03 AM, Atri Mahapatra wrote: > I have installed IDLE 3.5.1 and wrote the following to check if print is > working. When it runs, I do not see anything is printed: > > class Base: #{ > def __init__( self ): #{ > print("Hello, world: \n\n"); > > #} > >

Re: print() function with encoding= and errors= parameters?

2016-08-03 Thread Malcolm Greene
> You could use win_unicode_console enabled in sitecustomize or usercustomize. > https://pypi.python.org/pypi/win_unicode_console The pypi link you shared has an excellent summary of the issues associated when working Unicode from the Windows terminal. Thank you Eryk. Malcolm -- https://mail.py

Re: print() function with encoding= and errors= parameters?

2016-08-03 Thread eryk sun
On Wed, Aug 3, 2016 at 3:35 PM, Malcolm Greene wrote: > But under Windows, the stdout is workstation specific and *never* UTF-8. So > the > occasional non-ASCII string trips up our diagnostic output when tested under > Windows. You could use win_unicode_console enabled in sitecustomize or usercu

Re: print() function with encoding= and errors= parameters?

2016-08-03 Thread Malcolm Greene
Chris, > Don't forget that the print function can simply be shadowed. I did forget! Another excellent option. Thank you! Malcolm -- https://mail.python.org/mailman/listinfo/python-list

Re: print() function with encoding= and errors= parameters?

2016-08-03 Thread Chris Angelico
On Thu, Aug 4, 2016 at 1:35 AM, Malcolm Greene wrote: > My use case was diagnostic output being (temporarily) output to stdout > via debug related print statements. The output is for debugging only and > not meant for production. I was looking for a solution that would allow > me to output to the

Re: print() function with encoding= and errors= parameters?

2016-08-03 Thread Malcolm Greene
Thank you Random832 and Peter - excellent ideas. My use case was diagnostic output being (temporarily) output to stdout via debug related print statements. The output is for debugging only and not meant for production. I was looking for a solution that would allow me to output to the console with

Re: print() function with encoding= and errors= parameters?

2016-08-03 Thread Random832
On Wed, Aug 3, 2016, at 11:09, Peter Otten wrote: > I'm unsure about this myself -- wouldn't it be better to detach the > underlying raw stream? Like Well, "better" depends on your point of view. > The ValueError raised if you try to write to the original stdout > looks like a feature to me. Ma

Re: print() function with encoding= and errors= parameters?

2016-08-03 Thread Peter Otten
Random832 wrote: > On Wed, Aug 3, 2016, at 08:29, Malcolm Greene wrote: >> Looking for a way to use the Python 3 print() function with encoding and >> errors parameters. >> Are there any concerns with closing and re-opening sys.stdout so >> sys.stdout has a specific encoding and errors behavior?

Re: print() function with encoding= and errors= parameters?

2016-08-03 Thread Random832
On Wed, Aug 3, 2016, at 08:29, Malcolm Greene wrote: > Looking for a way to use the Python 3 print() function with encoding and > errors parameters. > > Are there any concerns with closing and re-opening sys.stdout so > sys.stdout has a specific encoding and errors behavior? Would this break > oth

Re: print size limit

2016-01-16 Thread Steven D'Aprano
On Sun, 17 Jan 2016 12:48 am, gliesia...@gmail.com wrote: > I'm doing a format conversion and all works fine until I add another 100 > characters... And then what happens? How many characters do you convert before that point? What does this "format conversion" do? > haven't determined exactl

Re: print size limit

2016-01-16 Thread Chris Angelico
On Sun, Jan 17, 2016 at 12:48 AM, wrote: > I'm doing a format conversion and all works fine until I add another 100 > characters... haven't determined exactly where the breaking point is... but > the initial conversion gets truncated and then fixes itself a little while > in. Is there a limit

Re: print("%.2f" % total)

2015-11-21 Thread Frank Millman
"Cai Gengyang" wrote in message news:d34dc21b-fe74-40fc-9b54-c37110529...@googlegroups.com... meal = 44.50 tax = 0.0675 tip = 0.15 meal = meal + meal * tax total = meal + meal * tip print("%.2f" % total) What do the lines inside the parentheses in this statement print("%.2f" % total) mean

Re: print("%.2f" % total)

2015-11-21 Thread Chris Angelico
On Sun, Nov 22, 2015 at 5:30 PM, Cai Gengyang wrote: > What do the lines inside the parentheses in this statement print("%.2f" % > total) mean ? > > What does "%.2f" % total represent ? > This is called "percent formatting" or "printf-style formatting". It's a means of formatting a tuple of valu

Re: print("%.2f" % total)

2015-11-21 Thread Stephane Wirtel
print the two digits after the point. On 11/21, Cai Gengyang wrote: > > meal = 44.50 > tax = 0.0675 > tip = 0.15 > > meal = meal + meal * tax > total = meal + meal * tip > > print("%.2f" % total) > > What do the lines inside the parentheses in this statement print("%.2f" % > total) mean ?

Re: print to screen and file with one print statement

2014-08-27 Thread Chris Angelico
On Thu, Aug 28, 2014 at 8:23 AM, KS wrote: > Can you please let me know where do I add flush(self) and get > sys.stdout.flush() to work? Check the dates. You're responding to a 2013 response to a 2003 post. If you have a question about something this old, it's probably best to start a new thread

Re: print to screen and file with one print statement

2014-08-27 Thread KS
Hi Mike/Ami, Can you please let me know where do I add flush(self) and get sys.stdout.flush() to work? Thanks, KS -- https://mail.python.org/mailman/listinfo/python-list

Re: print statements and profiling a function slowed performance

2014-06-29 Thread Chris Angelico
On Sun, Jun 29, 2014 at 4:14 PM, Dennis Lee Bieber wrote: > On Sat, 28 Jun 2014 23:50:26 +1000, Chris Angelico > declaimed the following: > >>No, they were measured; but the exact difference will depend on Python >>version, console, OS, etc, etc, etc, etc, etc, which is why I said >>"maybe 100ms"

Re: print statements and profiling a function slowed performance

2014-06-28 Thread Chris Angelico
On Sun, Jun 29, 2014 at 12:25 PM, Rustom Mody wrote: > On Sunday, June 29, 2014 12:50:19 AM UTC+5:30, Marko Rauhamaa wrote: >> Chris Angelico wrote: > >> > Threading is a focus of so many myths. People who don't understand it >> > think that threads are magic pixie dust that fixes everything, or e

Re: print statements and profiling a function slowed performance

2014-06-28 Thread Rustom Mody
On Sunday, June 29, 2014 12:50:19 AM UTC+5:30, Marko Rauhamaa wrote: > Chris Angelico wrote: > > Threading is a focus of so many myths. People who don't understand it > > think that threads are magic pixie dust that fixes everything, or else > > magic pixie dust that breaks everything. Or both, at

Re: print statements and profiling a function slowed performance

2014-06-28 Thread Chris Angelico
On Sun, Jun 29, 2014 at 5:20 AM, Marko Rauhamaa wrote: > Chris Angelico : > >> Threading is a focus of so many myths. People who don't understand it >> think that threads are magic pixie dust that fixes everything, or else >> magic pixie dust that breaks everything. Or both, at the same time. >> N

Re: print statements and profiling a function slowed performance

2014-06-28 Thread Marko Rauhamaa
Chris Angelico : > Threading is a focus of so many myths. People who don't understand it > think that threads are magic pixie dust that fixes everything, or else > magic pixie dust that breaks everything. Or both, at the same time. > Neither notion is true. I'm in the latter camp. More precisely

Re: print statements and profiling a function slowed performance

2014-06-28 Thread Chris Angelico
On Sat, Jun 28, 2014 at 11:41 PM, Dennis Lee Bieber wrote: > On Fri, 27 Jun 2014 12:06:54 +1000, Chris Angelico > declaimed the following: > >> >>If x is, say, range(100), a simple "for foo in x: pass" will >>complete fairly quickly (maybe 100ms on my computer), while the >>progress-indicated

Re: print statements and profiling a function slowed performance

2014-06-27 Thread Mark Lawrence
On 28/06/2014 01:12, Skip Montanaro wrote: On Fri, Jun 27, 2014 at 4:35 PM, Ian Kelly wrote: That's got to count for something, compared to a raw print that has to wait for the I/O to finish. A raw print basically just tosses some bytes in a stdio buffer (at least in Unix-land). Exactly, i

Re: print statements and profiling a function slowed performance

2014-06-27 Thread Chris Angelico
On Sat, Jun 28, 2014 at 10:12 AM, Skip Montanaro wrote: > threading-doesn't-always-speed-things-up-ly, y'rs, Threading is a focus of so many myths. People who don't understand it think that threads are magic pixie dust that fixes everything, or else magic pixie dust that breaks everything. Or bot

Re: print statements and profiling a function slowed performance

2014-06-27 Thread Skip Montanaro
On Fri, Jun 27, 2014 at 4:35 PM, Ian Kelly wrote: > That's got to count for > something, compared to a raw print that has to wait for the I/O to > finish. A raw print basically just tosses some bytes in a stdio buffer (at least in Unix-land). Stdio does whatever little it does, then passes the by

Re: print statements and profiling a function slowed performance

2014-06-27 Thread Ian Kelly
On Fri, Jun 27, 2014 at 10:05 AM, Skip Montanaro wrote: > On Fri, Jun 27, 2014 at 10:55 AM, Mark Lawrence > wrote: >> Expectations don't count, measure it :) > > It's no contest. I have measured it (ages ago). The logging module > does so many things that it's impossible for it to ever be as fas

Re: print statements and profiling a function slowed performance

2014-06-27 Thread Skip Montanaro
On Fri, Jun 27, 2014 at 10:55 AM, Mark Lawrence wrote: > Expectations don't count, measure it :) It's no contest. I have measured it (ages ago). The logging module does so many things that it's impossible for it to ever be as fast as a simple print statement. Look at the code in LogRecord.__init_

Re: print statements and profiling a function slowed performance

2014-06-27 Thread Mark Lawrence
On 27/06/2014 03:55, Steven D'Aprano wrote: On Thu, 26 Jun 2014 13:37:41 -0700, CM wrote: On Thursday, June 26, 2014 3:27:48 PM UTC-4, Mark Lawrence wrote: 3. use the logging module :) I've just never got around to it, but I guess I should. Thanks for the nudge. While using the logging m

Re: print statements and profiling a function slowed performance

2014-06-26 Thread Chris Angelico
On Fri, Jun 27, 2014 at 12:55 PM, Steven D'Aprano wrote: > On Thu, 26 Jun 2014 13:37:41 -0700, CM wrote: > >> On Thursday, June 26, 2014 3:27:48 PM UTC-4, Mark Lawrence wrote: >> >>> 3. use the logging module :) >> >> I've just never got around to it, but I guess I should. Thanks for the >> nudge

Re: print statements and profiling a function slowed performance

2014-06-26 Thread Steven D'Aprano
On Thu, 26 Jun 2014 13:37:41 -0700, CM wrote: > On Thursday, June 26, 2014 3:27:48 PM UTC-4, Mark Lawrence wrote: > >> 3. use the logging module :) > > I've just never got around to it, but I guess I should. Thanks for the > nudge. While using the logging module is recommended for logging, if

Re: print statements and profiling a function slowed performance

2014-06-26 Thread Chris Angelico
On Fri, Jun 27, 2014 at 6:36 AM, CM wrote: >> Yes, it stands to reason that profiling code >> is going to introduce a runtime cost. How else >> would we expect profiling to work? > > I think I was hoping for magic. :D Thank you for being honest :) The fact is, though, that time-of-day and consol

Re: print statements and profiling a function slowed performance

2014-06-26 Thread Michael Torrie
On 06/26/2014 02:36 PM, CM wrote: >> What I do find Heisenbergian are bugs that show >> up when debugging and profiling stuff are removed, >> but completely gone when present. IE profiling and >> debugging slow it down enough that often subtle race >> conditions are masked. > > Would never ha

Re: print statements and profiling a function slowed performance

2014-06-26 Thread CM
On Thursday, June 26, 2014 3:27:48 PM UTC-4, Mark Lawrence wrote: > 3. use the logging module :) I've just never got around to it, but I guess I should. Thanks for the nudge. -- https://mail.python.org/mailman/listinfo/python-list

Re: print statements and profiling a function slowed performance

2014-06-26 Thread CM
> Seems like over the years good old fashioned > debugging skills have been lost. In the earliest > days of IDEs (Turbo BASIC and QuickBASIC) I > regularly would employ debuggers with break > points, watches, and step through my code. I do also use a debugger, but lazily use print stateme

Re: print statements and profiling a function slowed performance

2014-06-26 Thread Mark Lawrence
On 26/06/2014 19:44, CM wrote: Huh. I learned two new Python facts this week: 1. print statements were slowing down my code enough to really notice a particular transition. It went from about 2-3 seconds to a bit under 1 second. What at first seemed unresponsive now seems almost snappy. The only

Re: print statements and profiling a function slowed performance

2014-06-26 Thread Michael Torrie
On 06/26/2014 12:44 PM, CM wrote: > Huh. I learned two new Python facts this week: > > 1. print statements were slowing down my code enough to > really notice a particular transition. It went from about > 2-3 seconds to a bit under 1 second. What at first seemed > unresponsive now seems almost sna

Re: print range in python3.3

2014-01-05 Thread Ian Kelly
On Jan 5, 2014 1:04 AM, "Mark Lawrence" wrote: > > On 05/01/2014 07:38, luofeiyu wrote: > > range(1,10) >> >> range(1, 10) > > print(range(1,10)) >> >> range(1, 10) >> >> how can i get 1,2,3,4,5,6,7,8,9 in python3.3 ? >> > > for i in range(1,10): > print(i, end=',') > print() >

Re: print range in python3.3

2014-01-05 Thread Mark Lawrence
On 05/01/2014 07:38, luofeiyu wrote: range(1,10) range(1, 10) print(range(1,10)) range(1, 10) how can i get 1,2,3,4,5,6,7,8,9 in python3.3 ? for i in range(1,10): print(i, end=',') print() I hope you can cope with the comma at EOL :) -- My fellow Pythonistas, ask not what our languag

Re: print range in python3.3

2014-01-04 Thread Chris Angelico
On Sun, Jan 5, 2014 at 6:38 PM, luofeiyu wrote: range(1,10) > range(1, 10) print(range(1,10)) > range(1, 10) > > how can i get 1,2,3,4,5,6,7,8,9 in python3.3 ? Are you looking for a list? That's what Python 2 returned. In Python 3, you can get that like this: >>> list(range(1,10)) [1,

Re: Print a text at a specific location on the page

2013-12-04 Thread Peter Otten
loic.esp...@gmail.com wrote: > Hi all > > This is my first post on this list :-) > > I have a web-application (developped using a python framework). In this > web-app, I would like to print certificates for some courses. > > The principle : > The course teacher has a "default" certificates, wit

Re: Print statement not printing as it suppose to

2013-09-20 Thread Dave Angel
On 20/9/2013 17:57, Sam wrote: > > print("\nThe total amount required is ", total ) > > > ('\nThe total amount required is ', 3534) > > ===> the problem is obviously on the last print statement that is supposed to > print the outut Others have pointed out the version discrepancy. But I'll also

Re: Print statement not printing as it suppose to

2013-09-20 Thread Chris Angelico
On Sat, Sep 21, 2013 at 7:57 AM, Sam wrote: > car=int(input("Lamborghini tune-up:")) > print("\nThe total amount required is ", total ) > OUTPUT > ('\nThe total amount required is ', 3534) As others have said, this output indicates that you're running under a Python 2.x interpreter. I strongly re

Re: Print statement not printing as it suppose to

2013-09-20 Thread John Gordon
In <05bbf1a3-6480-48ee-8984-2482b90c7...@googlegroups.com> Sam writes: > print("\nThe total amount required is ", total ) > OUTPUT > ('\nThe total amount required is ', 3534) In older versions of python (like the one you are using), 'print' is a statement instead of a function. In other word

  1   2   3   4   5   >