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:
> >>
>
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
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__ =
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");
>
> #}
>
>
> 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
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
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
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
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
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
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?
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
On Wed, Sep 11, 2013, at 07:36 AM, Wayne Werner wrote:
> On Sat, 31 Aug 2013, candide wrote:
> > # -
> > for i in range(5):
> >print(i, end=' ') # <- The last ' ' is unwanted
> > print()
> > # -
>
> Then why not define end='' instead?
On Sat, 31 Aug 2013, candide wrote:
# -
for i in range(5):
print(i, end=' ') # <- The last ' ' is unwanted
print()
# -
Then why not define end='' instead?
-W
--
https://mail.python.org/mailman/listinfo/python-list
On 8/31/2013 7:15 PM, Joshua Landau wrote:
On 31 August 2013 23:08, Chris Angelico wrote:
On Sun, Sep 1, 2013 at 1:43 AM, Oscar Benjamin
wrote:
On 31 August 2013 16:30, Chris Angelico wrote:
but doesn't solve all the cases (imagine a string or an iterator).
Similar but maybe simpler, and
On 31 August 2013 23:08, Chris Angelico wrote:
> On Sun, Sep 1, 2013 at 1:43 AM, Oscar Benjamin
> wrote:
>> On 31 August 2013 16:30, Chris Angelico wrote:
but doesn't solve all the cases (imagine a string or an iterator).
>>>
>>> Similar but maybe simpler, and copes with more arbitrary
On Sun, Sep 1, 2013 at 1:43 AM, Oscar Benjamin
wrote:
> On 31 August 2013 16:30, Chris Angelico wrote:
>>>
>>> but doesn't solve all the cases (imagine a string or an iterator).
>>
>> Similar but maybe simpler, and copes with more arbitrary iterables:
>>
>> it=iter(range(5))
>> print(next(it), en
Le 31/08/2013 15:59, Peter Otten a écrit :
To make it crystal clear, the above was to illustrate the algorithm used in
Python 2, not a suggestion.
Ok sorry, I misinterpreted.
> I still think you should live with a trailing space
Are you sure ? The following code
#
Le 31/08/2013 12:31, Peter Otten a écrit :
with `softspace` saved as a file attribute, is gone in Python3.
After reading
http://docs.python.org/3.0/whatsnew/3.0.html#print-is-a-function
I understand what you meant by "softspace". Thanks.
--
http://mail.python.org/mailman/listinfo/python-l
On 31 August 2013 16:30, Chris Angelico wrote:
>>
>> but doesn't solve all the cases (imagine a string or an iterator).
>
> Similar but maybe simpler, and copes with more arbitrary iterables:
>
> it=iter(range(5))
> print(next(it), end='')
> for i in it:
> print('',i, end='')
If you want to w
On Sat, Aug 31, 2013 at 11:33 PM, candide wrote:
> The if instruction imposes useless testing (we know in advance the problem
> to occur at the very end of the loop) and useless writing (writing '').
>
> The following is clearer
>
> # -
> n=5
> for i in range(n-1):
> pr
On Sat, 31 Aug 2013 14:59:17 +0200, candide wrote:
> Le 31/08/2013 13:16, Steven D'Aprano a écrit :
>
>
>> Of course it does. Have you actually tried it?
>
>
> Of course I did, redirecting the output to a file in order to spot an
> eventually trailing space. I did the same for the Python 3 cod
candide wrote:
> Le 31/08/2013 12:31, Peter Otten a écrit :
> > softspace = False
> > for i in range(5):
> > if softspace:
> > print(end=" ")
> > print(i, end="")
> > softspace = True
> > print()
>
>
> The if instruction imposes useless testing (we know in advance
Le 31/08/2013 13:24, Ned Batchelder a écrit :
For a beginner course, the trailing space is fine, use this code.
I was really expecting there was a trick but I'll follow your advice,
after all the trailing space is invisible!
Nevertheless, this can be quite annoying. For instance, some autom
Le 31/08/2013 12:31, Peter Otten a écrit :
> softspace = False
> for i in range(5):
> if softspace:
> print(end=" ")
> print(i, end="")
> softspace = True
> print()
The if instruction imposes useless testing (we know in advance the
problem to occur at the very end of the
Le 31/08/2013 13:16, Steven D'Aprano a écrit :
Of course it does. Have you actually tried it?
Of course I did, redirecting the output to a file in order to spot an
eventually trailing space. I did the same for the Python 3 code.
--
http://mail.python.org/mailman/listinfo/python-list
On 31 August 2013 12:16, Steven D'Aprano
wrote:
> On Sat, 31 Aug 2013 10:17:23 +0200, candide wrote:
>
>> What is the equivalent in Python 3 to the following Python 2 code:
>>
>> # -
>> for i in range(5):
>> print i,
>> # -
>>
>> ?
>>
>>
Steven D'Aprano wrote:
> On Sat, 31 Aug 2013 10:17:23 +0200, candide wrote:
>
>> What is the equivalent in Python 3 to the following Python 2 code:
>>
>> # -
>> for i in range(5):
>> print i,
>> # -
>>
>> ?
>>
>> Be careful that the
On 8/31/13 4:17 AM, candide wrote:
What is the equivalent in Python 3 to the following Python 2 code:
# -
for i in range(5):
print i,
# -
?
Be careful that the above code doesn't add a trailing space after the
last number in the lis
On Sat, 31 Aug 2013 10:17:23 +0200, candide wrote:
> What is the equivalent in Python 3 to the following Python 2 code:
>
> # -
> for i in range(5):
> print i,
> # -
>
> ?
>
> Be careful that the above code doesn't add a trailing spac
candide wrote:
> Le 31/08/2013 10:43, Andreas Perstinger a écrit :
>
> > How about
> >
> > >>> print(" ".join(str(i) for i in range(5)))
> > 0 1 2 3 4
> >
>
>
> Thanks for your answer. The output is stricly the same but the code
> doesn't suit my needs :
>
> 1) I'm porting to Python 3 a
Le 31/08/2013 10:43, Andreas Perstinger a écrit :
> How about
>
> >>> print(" ".join(str(i) for i in range(5)))
> 0 1 2 3 4
>
Thanks for your answer. The output is stricly the same but the code
doesn't suit my needs :
1) I'm porting to Python 3 a Python 2 full beginner course : the
learner
On 31.08.2013 10:17, candide wrote:
What is the equivalent in Python 3 to the following Python 2 code:
# -
for i in range(5):
print i,
# -
?
How about
>>> print(" ".join(str(i) for i in range(5)))
0 1 2 3 4
Bye, Andreas
--
ht
On Sat, 22 Sep 2012 01:26:43 +, Steven D'Aprano wrote:
> On Fri, 21 Sep 2012 13:20:09 -0700, gengyangcai wrote:
>
>> I am currently using Python 3.2.3 . WHen I use the print function by
>> typing print "Game Over" , it mentions " SyntaxError : invalid syntax
>> ". Any ideas on what the prob
On 22/09/2012 02:26, Steven D'Aprano wrote:
On Fri, 21 Sep 2012 13:20:09 -0700, gengyangcai wrote:
I am currently using Python 3.2.3 . WHen I use the print function by
typing print "Game Over" , it mentions " SyntaxError : invalid syntax
". Any ideas on what the problem is and how to resolve
On Fri, 21 Sep 2012 13:20:09 -0700, gengyangcai wrote:
> I am currently using Python 3.2.3 . WHen I use the print function by
> typing print "Game Over" , it mentions " SyntaxError : invalid syntax
> ". Any ideas on what the problem is and how to resolve it ?
No, none what so ever. Perhaps you
On Fri, Sep 21, 2012 at 3:11 PM, Alister wrote:
> On Fri, 21 Sep 2012 14:54:14 -0600, Ian Kelly wrote:
>
>> On Fri, Sep 21, 2012 at 2:28 PM, Rodrick Brown
>> wrote:
>>> Go away troll!
>>
>> Troll? It looked like a sincere question to me.
>
> but one that page 1 of the documentation would answer.
In
gengyang...@gmail.com writes:
> I am currently using Python 3.2.3 . WHen I use the print function by
> typing print "Game Over" , it mentions " SyntaxError : invalid syntax ".
> Any ideas on what the problem is and how to resolve it ? Thanks a lot .
In python version 3, print was changed i
On Fri, 21 Sep 2012 14:54:14 -0600, Ian Kelly wrote:
> On Fri, Sep 21, 2012 at 2:28 PM, Rodrick Brown
> wrote:
>> Go away troll!
>
> Troll? It looked like a sincere question to me.
but one that page 1 of the documentation would answer.
--
Waste not, get your budget cut next year.
--
http:/
On Fri, Sep 21, 2012 at 2:28 PM, Rodrick Brown wrote:
> Go away troll!
Troll? It looked like a sincere question to me.
--
http://mail.python.org/mailman/listinfo/python-list
Go away troll!
Sent from my iPhone
On Sep 21, 2012, at 4:27 PM, "gengyang...@gmail.com"
wrote:
> Hello ,
>
>
> I am currently using Python 3.2.3 . WHen I use the print function by typing
> print "Game Over" , it mentions " SyntaxError : invalid syntax ". Any ideas
> on what the problem is a
On 9/21/12 10:20 PM, gengyang...@gmail.com wrote:
Hello ,
I am currently using Python 3.2.3 . WHen I use the print function by typing print "Game
Over" , it mentions " SyntaxError : invalid syntax ". Any ideas on what the
problem is and how to resolve it ? Thanks a lot .
print was a stat
Dennis Lee Bieber wrote:
Does Python 3.x include SQLite?
Of course ;-]
>>> import sqlite3
>>> dir(sqlite3)
['Binary', 'Cache', 'Connection', 'Cursor', 'DataError',
[snip]
adapt', 'adapters', 'apilevel', 'complete_statement', 'connect',
'converters', 'datetime', 'dbapi2', 'enable_callback_tr
Anjanesh Lekshminarayanan wrote:
>> Maybe it would help if you explained what you are actually trying to
>> accomplish.
>
> import csv
> f = csv.reader(open('data.txt'), delimiter='\t') # 2GB text file
> sql = "INSERT INTO `data` VALUES (NULL,%s,%s,%s,%s,%s);"
> for row in f:
> print (sql, (r
> Maybe it would help if you explained what you are actually trying to
> accomplish.
import csv
f = csv.reader(open('data.txt'), delimiter='\t') # 2GB text file
sql = "INSERT INTO `data` VALUES (NULL,%s,%s,%s,%s,%s);"
for row in f:
print (sql, (row[0],row[1],row[2],row[3],row[4]))
$ python3 p
Anjanesh Lekshminarayanan wrote:
> As of now, there is no mysql adaptor for Python3. Hence cant use
> escape_string()
Maybe it would help if you explained what you are actually trying to
accomplish.
--
Carsten Haese
http://informixdb.sourceforge.net
--
http://mail.python.org/mailman/listinfo/p
As of now, there is no mysql adaptor for Python3. Hence cant use escape_string()
> I don't have the slightest clue what you want to say with that.
--
Anjanesh Lekshmnarayanan
--
http://mail.python.org/mailman/listinfo/python-list
Anjanesh Lekshminarayanan wrote:
>> Depending on your DB-adapter, you are out of luck here. Either connect to
>> a db even if you don't need it, or try & see if you can locate the
>> implementation in the module somehow.
>
> ImportError: No module named MySQLdb
> MySQLdb only available in Python2
> Depending on your DB-adapter, you are out of luck here. Either connect to a
> db even if you don't need it, or try & see if you can locate the
> implementation in the module somehow.
ImportError: No module named MySQLdb
MySQLdb only available in Python2.
--
Anjanesh Lekshmnarayanan
--
http:
Anjanesh Lekshminarayanan wrote:
> Python 3.1.1
>
> sql = "INSERT INTO `tbl` VALUES (NULL, '%s', '%s', '%s', '%s', '%s');"
> for row in fp:
> print (sql, (row[0],row[1],row[2],row[3],row[4]))
> .
> INSERT INTO `tbl` VALUES (NULL, '%s', '%s', '%s', '%s', '%s'); ('142',
> 'abc', '2006-04-09 02:
Bertrand-Xavier M. wrote:
> On Tuesday 25 July 2006 05:52, Eric Bishop wrote:
> > Why does this work:
> >
> > # start
> > a = 5
> >
> > print a, 'is the number'
> >
> > #end, prints out "5 is the number"
> >
> > But not this:
> >
> > # start
> >
> > a = 5
> >
> > print a 'is the number'
> >
> > #en
On Tuesday 25 July 2006 05:52, Eric Bishop wrote:
> Why does this work:
>
> # start
> a = 5
>
> print a, 'is the number'
>
> #end, prints out "5 is the number"
>
> But not this:
>
> # start
>
> a = 5
>
> print a 'is the number'
>
> #end, errors out
>
> The difference here is the comma seperating th
52 matches
Mail list logo