Re: Printing Unicode strings in a list

2022-04-30 Thread Vlastimil Brom
čt 28. 4. 2022 v 13:33 odesílatel Stephen Tucker
 napsal:
>
> Hi PythonList Members,
>
> Consider the following log from a run of IDLE:
>
> ==
>
> Python 2.7.10 (default, May 23 2015, 09:40:32) [MSC v.1500 32 bit (Intel)]
> on win32
> Type "copyright", "credits" or "license()" for more information.
> >>> print (u"\u2551")
> ║
> >>> print ([u"\u2551"])
> [u'\u2551']
> >>>
>
> ==
>
> Yes, I am still using Python 2.x - I have good reasons for doing so and
> will be moving to Python 3.x in due course.
>
> I have the following questions arising from the log:
>
> 1. Why does the second print statement not produce [ ║]  or ["║"] ?
>
> 2. Should the second print statement produce [ ║]  or ["║"] ?
>
> 3. Given that I want to print a list of Unicode strings so that their
> characters are displayed (instead of their Unicode codepoint definitions),
> is there a more Pythonic way of doing it than concatenating them into a
> single string and printing that?
>
> 4. Does Python 3.x exhibit the same behaviour as Python 2.x in this respect?
>
> Thanks in anticipation.
>
> Stephen Tucker.
> --
> https://mail.python.org/mailman/listinfo/python-list

Hi,
I'm not sure, whether I am not misunderstanding the 4th question or
the answers to it (it is not clear to me, whether the focus is on
character printing or the quotation marks...);
in either case, in python3 the character glyphs are printed in these
cases, instead of the codepoint number notation, cf.:
==
Python 3.8.10 (tags/v3.8.10:3d8993a, May  3 2021, 11:48:03) [MSC v.1928 64 bit (
AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> print ([u"\u2551"])
['║']
>>>
>>> print([u"\u2551"])
['║']
>>> print("\u2551")
║
>>> print("║")
║
>>> print(repr("\u2551"))
'║'
>>> print(ascii("\u2551"))
'\u2551'
>>>
==

(Even the redundant u prefix from your python2 sample is apparently
accepted, maybe for compatibility reasons.)

hth,
   vbr
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Printing Unicode strings in a list

2022-04-30 Thread Chris Angelico
On Sun, 1 May 2022 at 00:03, Vlastimil Brom  wrote:
> (Even the redundant u prefix from your python2 sample is apparently
> accepted, maybe for compatibility reasons.)

Yes, for compatibility reasons. It wasn't accepted in Python 3.0, but
3.3 re-added it to make porting easier. It doesn't do anything.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Python Question re Executing a Script

2022-04-30 Thread Brent Hunter
Hello,

I just purchased a new Windows 11 computer and installed Python 3.10.4 (64 
bit).  I can't figure out from your documentation, how do I:


  1.  Run a python script that is located in the same directory ( 
C:\Users\Brent\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Python 
3.10 )


  1.  How do I automatically run a python app at Windows startup?

Thank you!

Brent Hunter

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python Question re Executing a Script

2022-04-30 Thread dn
On 01/05/2022 10.37, Brent Hunter wrote:
> Hello,
> 
> I just purchased a new Windows 11 computer and installed Python 3.10.4 (64 
> bit).  I can't figure out from your documentation, how do I:
> 
> 
>   1.  Run a python script that is located in the same directory ( 
> C:\Users\Brent\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Python 
> 3.10 )
> 
> 
>   1.  How do I automatically run a python app at Windows startup?
> 
> Thank you!
> 
> Brent Hunter


Please start with https://docs.python.org/3/using/windows.html

-- 
Regards,
=dn
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python Question re Executing a Script

2022-04-30 Thread Dennis Lee Bieber
On Sat, 30 Apr 2022 22:37:35 +, Brent Hunter 
declaimed the following:

>Hello,
>
>I just purchased a new Windows 11 computer and installed Python 3.10.4 (64 
>bit).  I can't figure out from your documentation, how do I:
>
>
>  1.  Run a python script that is located in the same directory ( 
> C:\Users\Brent\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Python 
> 3.10 )
>

ONE: that path indicates that you installed Python "for current user
only".

TWO: that is the path for the short cut entry that shows up on the
Windows "Start Menu" (whatever that looks like on Win11). It is NOT a
location for user scripts.

Python, at heart, is a language interpreter that is invoked from a
command line shell. (Use  to exit the interpreter if you are trying
the below examples -- otherwise you'd add the path/name of the script file
to the command line)

-=-=-
Microsoft Windows [Version 10.0.19044.1645]
(c) Microsoft Corporation. All rights reserved.

C:\Users\Wulfraed>python
Python ActivePython 3.8.2 (ActiveState Software Inc.) based on
 on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>

C:\Users\Wulfraed>py
Python ActivePython 3.8.2 (ActiveState Software Inc.) based on
 on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>

C:\Users\Wulfraed>
-=-=-

It can run from scripts invoked by double-clicking on the file in the
"file explorer" but often the results are not as desired (it will pop up a
console window -- but that window closes as soon as the script exits!).
Scripts written using one of the graphical libraries (Tkinter, wxPython,
etc.) are typically given a .pyw extension -- .pyw is normally associated
with an alternate start-up module which suppresses the console window.

Editing of scripts can be done with one's favorite programming text
editor. If one can't live without having some sort of IDE, look for
something called IDLE to be on your start menu (IDLE is actually a Python
script using Tkinter).

>
>  1.  How do I automatically run a python app at Windows startup?

Short answer: the same way you would run ANY application at start-up. 

Longer answer: this is a feature of the OS, not Python. You will need
to learn how to use the OS. Maybe start with
https://www.google.com/search?q=run+application+at+startup+windows+11&source=hp&ei=t1htYpm0K5OtqtsPiMKMwAc&iflsig=AJiK0e8AYm1mx0aL7YbWlEj0j-yPiL8J4H8HFoxo&ved=0ahUKEwjZ6-T3j7z3AhWTlmoFHQghA3gQ4dUDCAk&uact=5&oq=run+application+at+startup+windows+11&gs_lcp=Cgdnd3Mtd2l6EAMyBQghEKsCMgUIIRCrAjIFCCEQqwIyCAghEBYQHRAeOgUIABCABDoOCC4QgAQQsQMQgwEQ1AI6CAgAEIAEELEDOhEILhCABBCxAxCDARDHARDRAzoICC4QgAQQsQM6CwgAEIAEELEDEIMBOggILhCxAxCDAToFCC4QgAQ6EQguEIAEELEDEIMBEMcBEKMCOgsILhCABBDHARCjAjoICC4QgAQQ1AI6CwguEIAEELEDEIMBOgsILhCABBCxAxDUAjoOCC4QsQMQgwEQxwEQowI6DgguEIAEELEDEMcBENEDOg4ILhCABBCxAxCDARDJAzoICAAQsQMQgwE6BwgAEIAEEAo6CAgAEIAEEMkDOgYIABAWEB46BQgAEIYDUL0NWNRZYO9caAFwAHgBgAHYAYgBpx6SAQcyNC4xMi4xmAEAoAEBsAEA&sclient=gws-wiz

>
>Thank you!
>
>Brent Hunter


-- 
Wulfraed Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python Question re Executing a Script

2022-04-30 Thread Mike Dewhirst

On 1/05/2022 8:37 am, Brent Hunter wrote:

Hello,

I just purchased a new Windows 11 computer and installed Python 3.10.4 (64 
bit).  I can't figure out from your documentation, how do I:


   1.  Run a python script that is located in the same directory ( 
C:\Users\Brent\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Python 
3.10 )


   1.  How do I automatically run a python app at Windows startup?


https://www.windowscentral.com/how-launch-apps-automatically-during-login-windows-11

Personally, I write a batch file containing the 'python 
/location/of/script.py' command line and call that batch file. That 
assumes python.exe is on the Windows path.


Once tested and working it lets me edit the batch file to adjust the 
payload without having to touch the Windows stuff again.







Thank you!

Brent Hunter




--
Signed email is an absolute defence against phishing. This email has
been signed with my private key. If you import my public key you can
automatically decrypt my signature and be sure it came from me. Just
ask and I'll send it to you. Your email software can handle signing.



OpenPGP_signature
Description: OpenPGP digital signature
-- 
https://mail.python.org/mailman/listinfo/python-list